http://www.perlmonks.org?node_id=1017169


in reply to RegEx - Positive Look-ahead

I'm not clear headed ATM to figure out your regex, but you should check out these

?? perlfaq -> perlfaq6 -> Can I use Perl regular expressions to match balanced text?

?? perlfaq6#What good is \G in a regular expression?

Re: print output from the text file. (marpa scanless dsl calculator), Re^2: Help with regular expression ( m/\G/gc ),

Replies are listed 'Best First'.
Re^2: RegEx - Positive Look-ahead
by tmharish (Friar) on Feb 05, 2013 at 14:45 UTC

    Thank You!

    I modified my RegEx like so:

    ( # start of capture group 1 {{ # match an opening (?: [^{{}}]++ # one or more, non backtracking | (?1) # found {{ or }}, so recurse to captur +e group 1 )* }} # match a closing ) # end of capture group 1

    The problem is that this does not match if I have {{ something {{{ text }}} }} in my content ...

      if you want to match {{{ and {{ maybe you can make it
      [{]{2,3} # opener [}]{2,3} # closer