I need a regular expression to capture field names listed in a string. They are listed between
Here are my requirements:
- field names in curly braces
- field names have no spaces
- curly braces can be escaped with a \
So in the following:
capture {this} text and exclude \{that}?
The matches are {this} but not {that}.
I’m using PHP and preg_match (i could use a diff function, i’m open to ideas)
Any ideas?
care to explain the result as well for me so I might learn something 🙂
In details you can read about negative assertion
(?<!here