I am trying to use curly braces in a custom markup, using preg_replace to convert them into the final HTML, but I keep getting rewarded with error messages.
The basic search string I’m working with is /{{(.+?)}}{/ which should match any string of the format “{{foo}}{“. Deleting the final two braces allows it to match “{{foo}}” just fine, otherwise I am told:
Parse error: syntax error, unexpected ‘}’
I therefore conclude that PCRE thinks I’m trying to start a quantifier, and I wouldn’t blame it, except it gives exactly the same error if I escape { with .
Any help with this will be fantastically appreciated. I’ve been working on this preg_replace array for days, and I don’t think there’s any part of it that hasn’t caused my consternation. Thank you in advance!