Input:
start
some
T1
random
T2
text
T3
end
should result in:
start
T1
T2
T3
end
I tried using
>(?<=start)[\S\s]*?(?=end)
to match everything between start and end
and exclude T1 T2 T3 with:
^(?!T\d)
Is it possible to combine them into a single regex that can be pasted into notepad++ for people not familiar with writing code to do it in several passes?
You could use this regular expression:
Find: ^(?!T\d|start).*\R(?=(^(?!start$).*\R)*end$)
Replace: (empty)
. matches newlines: No
Click "Replace All"
These assumptions are made:
start and end delimiters should each be the only text on their lines (so not ---start or start ///), start and then end)start cannot come another start before you have an end.The look-ahead makes this a rather inefficient regular expression, as with each match it needs to check again the text that follows until the next end.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With