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)

see demo @ regex101.com


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -