Ignoring escaped literals
Posted: Fri Dec 26, 2008 3:37 pm
I have the following simple regex:
This works awesome, but...
I would llike to support literal '}' by having them escaped soa a string like:
I imagine this is possible using look aheads? How can I match two characters ahead of time and skip the '}' is it's prefix by a escape slash?
EDIT | It occured to me it might be possible by adding an alternative match to the mix inside the negated operation, something like this:
However this doesn't seem to work so I hope I am missing something simple...???
Cheers,
Alex
Code: Select all
"/{[^}]+)}/";
I would llike to support literal '}' by having them escaped soa a string like:
Code: Select all
{This is some text and an escaped \} which is not included as part of the string}EDIT | It occured to me it might be possible by adding an alternative match to the mix inside the negated operation, something like this:
Code: Select all
"/{[^}|\\}]+)}/";
Cheers,
Alex