Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
[\s\S]*?(keep\d\s+\{[^{}]*\})|(?:(?!keep\d\s+\{[^{}]*\})[\s\S])+$
/
gm
Input 1
1
New
blah blah Bob Loblaw Law blah keep1 { i want this } blop blah blob keep2 { and this too } blaw blat etc...
Substitution
$1\n
blah blah Bob Loblaw Law blah keep1 { i want this } blop blah blob keep2 { and this too } blaw blat etc...