I've got a line by line text from a file, stored in a string variable. It is strctured like this:
The goal is to remove every group of lines from
Regex
Regex
Does anyone have an idea to achieve that?
Thanks in advance.
START
Text1
KEYWORD:Line1 to be removed
...
Line n to be removed
STOP
START
Text2
KEYWORD:Line1 to be removed
...
Line n to be removed
STOP
The goal is to remove every group of lines from
KEYWORD
to STOP
to get such final string:START
Text1
START
Text2
Regex
KEYWORD.*STOP
doesn't work as dot "." doesn't match new linesRegex
KEYWORD[\s\S]*STOP
doesn't work either as it matches from the KEYWORD
first occurrence to the very last STOP
occurrence, removing all intermediate lines.Does anyone have an idea to achieve that?
Thanks in advance.