Similar escape sequences

I want to combine the number enclosed in curly braces, but the curly braces themselves are escape sequences, I want the match to begin with the last curly brace when there was an even number "em".

{0}    OK
{{0}   NOT OK
{{{0}  OK
{{{{0} NOT OK

I have lookahead / lookbehind statements:

(?<!\{\{)

But this does not correspond to repetitions {{{0}, and I am really not sure that this can be done without the participation of groups and quatifiers. (I would like this statement to not be part of the match)

Matching should be done anywhere on the line.

This is the best I got so far

(?<=^|[^\{]|\{\{)\{(?=\w)

, {{{{0} , , . docs, lookbehind , .

+3
1

, :

(?<!\{)\{(?:\{\{)*(?=\w)

:

  • (?<!\{) , {,
  • \{ {
  • (?:\{\{)* {{ ( {)
  • (?=\w) ,
+1

All Articles