Home > OS >  Notepad add new line above changing syntax with replace
Notepad add new line above changing syntax with replace

Time:01-29

I have a constant syntax of "Se " but there is a number in front of it that changes. I want to add a newline \n before the number. I've tried using \c to address any character (for the changing number) during replace, I don't know how to get the number part to copy over or work.

this is what it currently looks like

1            hinge 2pk
1            Se wall cabinet                                                   
4            door 15x40"

I want the new line to be above any item that includes "Se", so that it looks like this

1            hinge 2pk

1            Se wall cabinet                                                   
4            door 15x40"

this is what i've tried so far (not including parenthesis)

REPLACE TOOL

Find what: [\C            Se ]
Replace with: [\n\C            Se ]

✓ = Regular expression

but this is what I get

1            hinge 2pk

C            Se wall cabinet                                                   
4            door 15x40

How do I get the number to the left of "Se" to copy down (as this number is always changing)

CodePudding user response:

You can use:

^\d \h Se\b
  • ^ Start of string
  • \d Match 1 digits
  • \h Match 1 spaces
  • Se\b Match Se followed by a word boundary

enter image description here

CodePudding user response:

Well, try this simple code, hope it will help...

Find:^(\d.*? Se .*\n)
Replace with:\n$1 or \n\1

  •  Tags:  
  • Related