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

cron - how to properly run Python script with crontab on every system startup -

elasticsearch - Is the order of operations guaranteed in a bulk update? -

Slow performance first queries on SQL Azure -