regex - Remove surrounding text with regular expression -


i have code many functions, each containing own log entry. each log entry surrounded if statement. want remove if statement, leaving log entry, think can using regular expression find , replace.

for example:

if (log.isenabled()) {     log.write("log message variable: %s ", var); } 

should replaced with:

log.write("log message variable: %s", var); 

i've tried things along lines of if \(log.isenabled\(\)\) \{ (.*) } capture , group expression, haven't gotten work yet.

is there expression can capture log entry in middle can find/replace instead of doing hand?

thanks!

if won't have internal curly braces (the { , }) can use like

\{\s*(.*)\s*} 

...which according https://regex101.com matches

log.write("log message variable: %s ", var); 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -