in reply to ERROR ... nested quantifiers in regex

{ is special to the regex engine. See perlre.

You might want to replace your literal { with \{ or [{].

Replies are listed 'Best First'.
Re^2: ERROR ... nested quantifiers in regex
by Anonymous Monk on Jul 06, 2011 at 11:59 UTC
    FWIW, v5.12.2 has no trouble "parsing" this regex
    Compiling REx "%n ( # start of bracket 1%n {{ # match an opening + {{ b"... Final program: 1: OPEN1 (3) 3: EXACT <{{> (5) 5: CURLYX[0] {0,32767} (30) 7: BRANCH (24) 8: SUSPEND (29) 10: PLUS (22) 11: ANYOF[\0-z|~-\377][{unicode_all}] (0) 22: SUCCEED (0) 23: TAIL (28) 24: BRANCH (FAIL) 25: GOSUB1[-24] (29) 28: TAIL (29) 29: WHILEM[2/1] (0) 30: NOTHING (31) 31: EXACT <}}> (33) 33: CLOSE1 (35) 35: END (0) anchored "{{" at 0 floating "}}" at 2..2147483647 (checking floating) +minlen 4
    and (?1) # recurse to bracket 1 appears to be a feature introduced in 5.10 (?PARNO) (?-PARNO) (?+PARNO) (?R) (?0)
      I think this maybe the problem, because I use active perl 5.8, I guess I have to download the newest version ... I'll try it and then let you know, thanks a lot for your support
Re^2: ERROR ... nested quantifiers in regex
by &#350;uRvīv&#337;r (Novice) on Jul 06, 2011 at 11:45 UTC
    it seems that this line [^{}]++ # one or more {} brackets, non backtracking is causing the error ... and to be honest, I tried to understand it but i couldn't
      You need to use a perl older than 5.10 to use these regex features you were trying to use, they were introduced in
      p595-Possessive Quantifiers
      Perl now supports the "possessive quantifier" syntax of the "atomic match" pattern. Basically a possessive quantifier matches as much as it can and never gives any back. Thus it can be used to control backtracking. The syntax is similar to non-greedy matching, except instead of using a '?' as the modifier the '+' is used. Thus ?+, *+, ++, {min,max}+ are now legal quantifiers. (Yves Orton)
        ... a perl older than 5.10 ...

        Should be: "... a Perl of version 5.10 or newer ...".

Re^2: ERROR ... nested quantifiers in regex
by &#350;uRvīv&#337;r (Novice) on Jul 06, 2011 at 11:42 UTC
    I replaced every { and every } with \{\} and still giving the same error