How can I remove lines between two lines using regular expressions?
So, I have a file like:
FLAGSHARE
xxxxxx
xxxxx, 1 2015
words....
FLAGSHARE
xxxxxx
xxxxx, 2 2015
words....
FLAGSHARE
xxxxxx
xxxxx, 3 2015
words....
etc.etc.
How can I remove the three lines FLAGSHARE, xxxxxx, xxxxx, * 2015 (essentially remove FLAGSHARE, 2015 and the lines between FLAGSHARE and 2015) using Notepad ++?
+3
Ted
source
to share
2 answers
You can use the following:
FLAGSHARE[\s\S]*?2015
And replace with ''
(empty string)
See DEMO
+4
karthik manchala
source
to share
You can also use:
FLAGSHARE[\S\s]*?\d{4}
DEMO
which will also fit any year
You can also use:
FLAGSHARE[\S\s]*?20\d{2}
During any year in the format: 20 **
Or even:
FLAGSHARE[\S\s]*?\d\s*\d\n
What will work in all situations
DEMO
0
Downgoat
source
to share