I believe this would be the best / easiest possible regex for a specific grab of braces:
(?<={{).*?(?=}})
Broken, it says:
01 (?<={{)
With this expression, the ENTIRE match will consist of curly braces, and the curly braces will remain in place / ignored
To match the entire expression in braces, use the following:
01 {{
If you want to support multiple lines inside curly braces, use [\s\S]*?
instead of .*?
in part on line 02
or specify the "singleline" parameter for the regex parser (DOTALL in Java, etc.)., etc. etc.).
It does not reject instances such as some text {{{inside}}} other test
and may produce unwanted results - if possible, ask for a stronger expression and indicate several cases of what should and should not be matched.
source share