jcaruso
jcaruso

Reputation: 2494

Regular Expressions in Notepad++ starting with text and ending with incremental number

I'm trying to understand this as I'm reading tutorials and apply this to what I'm doing.

I have a file with lines of text like:

line1blahblahblahblah
line2blahblahblahblah
...
line10blahblahblahblah

I want to go in and remove the line and the number after it (which is incremented 1-1000 for each line) and replace it with new text leaving all the text after in tact.

Can someone explain how and explain the regex expression?

Upvotes: 0

Views: 3780

Answers (1)

p.s.w.g
p.s.w.g

Reputation: 149020

Search for

^line\d+

And replace with an empty string.

Explanation: The ^ matches the begining of the line, the line matches a literal character sequence, and the \d matches any digit character. The + after the \d makes it match one or more digits characters.

Your Notepad++ search panel should look like this: enter image description here

Upvotes: 1

Related Questions