Hi there,
I've been struggling with this seemingly simple regular expression problem. I'm hoping someone can show me how dumb I've been:
take the string {{aaa{{bbb}}ccc}}
What I need is a regex that would match the {{bbb}} part, but not the whole thing. Basically, anything in double brackets as long as it doesnt have nested stuff in double brackets within it. The tricky part is that its allowed to contain single brackets.
Some examples:
{{aa}} - want to match "aaa"
{{aaa{{bbb}}}} - want to match "bbb" (not "aaa{{bbb"!!!)
{{aaa{{bbb}}ccc}} - still want to match "bbb"
{{aaa{{b{bb}}ccc}}- want to match "b{bb"
Any suggestions?
I've been struggling with this seemingly simple regular expression problem. I'm hoping someone can show me how dumb I've been:
take the string {{aaa{{bbb}}ccc}}
What I need is a regex that would match the {{bbb}} part, but not the whole thing. Basically, anything in double brackets as long as it doesnt have nested stuff in double brackets within it. The tricky part is that its allowed to contain single brackets.
Some examples:
{{aa}} - want to match "aaa"
{{aaa{{bbb}}}} - want to match "bbb" (not "aaa{{bbb"!!!)
{{aaa{{bbb}}ccc}} - still want to match "bbb"
{{aaa{{b{bb}}ccc}}- want to match "b{bb"
Any suggestions?