2

I'm editing a long list of 5 numbers in Notepad but need to remove every line that begins with 2. How do I do this? Example list below...

1 9 11 18 29

2 9 11 18 29

3 9 11 18 29

4 9 11 18 29

5 9 11 18 29

6 9 11 18 29

1 2 12 18 29

2 3 12 18 29

2 4 12 18 29

1 5 12 18 29

Jean
  • 31
  • 2
  • I am not 100% but if Notepad++ has a regular expression search this worked for me using sublime text ^2(.*) to find the lines then replace with nothing. – Hard-Boiled Wonderland Jul 10 '13 at 18:41
  • Ok I did that but it removes lines that begin with 21,22,23,etc. also. – Jean Jul 10 '13 at 19:44
  • In that case the correct answer is below, much better info on removing the blank lines in notepad++ too! Just make sure you definitely put the space after the number 2 and before the opening parenthesis. – Hard-Boiled Wonderland Jul 10 '13 at 22:54

2 Answers2

2

Find ^2 (.*)$ and replace with nothing. This will replace each list of five numbers starting with a 2 with a blank line.

Alternatively, you can go to the Mark tab on the Search dialog, Bookmark the lines that match the pattern above, then Search > Bookmark > Remove Bookmarked Lines. This will completely remove lines that start with 2.

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
0

Use Notepad++ regex Find-and-Replace:

Find what:

^2[\s\S]+?^(?=\d)

Replace it with nothing.

Josh Withee
  • 9,922
  • 3
  • 44
  • 62