[ACCEPTED]-Regex: remove lines not starting with a digit-notepad++
You can clear up those line with
^[^0-9].* but it 9 will leave blank lines.
Notepad++ use scintilla, and 8 also using its regex engine to match those.
\r 7 and \n are never matched because in Scintilla, regular 6 expression searches are made line per 5 line (stripped of end-of-line chars).
To 4 clear up those blank lines, only way is 3 choose extended mode, and replace \n\n to 2 \n, If you are in windows mode change \r\n\r\n 1 to \r\n
[^0-9] is a regular expression that matches pretty 5 much anything, except digits. If you say 4
^[^0-9] you "anchor" it to the start of the line, in 3 most regular expression systems. If you 2 want to include the rest of the line, use 1
^[^\d].* marks a whole line whose first character 6 is not a digit. Check if there are really 5 no whitespaces in front of the digits. Otherwise 4 you'd have to use a different expression.
UPDATE: You 3 will have to do ot in two steps. First empty 2 the lines that do not start with a digit. Then 1 remove the empty lines in extended mode.
One could also use the technique of bookmarking 15 in Notepad++. I started benefiting from 14 this feature (long time present but only 13 more recently made somewhat more visible 12 in the UI) not very long ago.
Simply bring 11 up the find dialogue, type regex for lines 10 not starting with digit
^\D.*$ and select Mark 9 All. This will place blue circles, like 8 marbles, in the left gutter - these are 7 line bookmarks. Then just select from main 6 menu Search -> Bookmark -> Remove bookmarked 5 lines.
Bookmarks are cool, you could extract 4 these lines by simply selecting to copy 3 bookmarked lines, opening new document and 2 pasting lines there. I sometimes use this 1 technique when reviewing log files.
I'm not sure what you are asking. but the 5 reg exp for finding the lines with a digit 4 at the beginning would be ^\d.* you can 3 remove all the lines that match the above 2 or alternatly keep all the lines that match 1 this expression: ^[^\d].*
More Related questions