what is the regex for matching a string within two curly brackets as in
{{string}}
result should be string
.
Do I have to escape both curly brackets?
No, actually the following should work just fine:
"{{([^}]*)}}"
Edit:
As pointed out by dtb the expression above fails for a string containing a single }
within the double brackets. To handle this case the following example would do a much better job:
"{{((?:}(?!})|[^}])*)}}"
Edit 2: The simplest solution however would probably be the following:
"{{(.*?)}}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With