Hi I’m trying to write a regex statement to match a “{” character only if it is not in cased in quotes.
I then need to return (replace line) with everything (if anything) to the right of the character.
Similarly I need to do the same with the “}” character but return everything on the left. These need to be separate regex.
As an example:
if { something
Should MATCH and return ” something“
if { " something
Should MATCH and return ” " something“
" if { " something
Should NOT MATCH and not return anything
Unfortunately this isn’t something the .Net implementation of regex can do without running into edge cases. You’ll need to use a parser to do it properly. A basic state machine pattern where that iterates along the string and flips state when it hits the characters you’re looking for.