notepad++ - Regex to replace what's inside the bracket except the another brackets inside of it -
how replace what's inside bracket except brackets inside of it. replace zzzzz
.
{ "0000" "1111" 1111 { 222 } { 333 } }
will be:
{ zzzzz { 222 } { 333 } }
({\n\s*)(?:[^}{]*)(\n\s*{)
first, within capturing group, ()
, match {
, newline \n
, amount of space.
({\n\s*)
next, within non-capturing group, match not }{
, number of times.
(?:[^}{]*)
finally, closing how started: capture newline, amount of whitespace, , next opening {
.
(\n\s*{)
this won't match ones without internal brackets, nor work if internal brackets nested 3 layers. if provide examples of input, can improve match (like using behind skip internal matches)
Comments
Post a Comment