Match text surrounded by "{{" and "}}"
c#, regex
Solution
You can use balancing groups for counting and matching nested constructs like these. For example:
(?x) {{ ( (?: [^{}]+ | (?<open>{{) | (?<-open>}}) )* (?(open)(?!)) ) }}
Problem
I'm looking for a Regex which can do this : My text : ``` "Blablabla {{ blabla1 }} blablablabla {{ blablabla2 {{ blabla3 }} }} blablabla" ``` What I want to extract : ``` "blabla1" and "blablabla2 {{ blabla3 }}" ``` Does anyone has an idea ? I tried with : `"{{(.)*}}"` but it returns `"blabla1"` and `"blabla3"`