in reply to Re^2: A regexp to parse nested brackets containing strings
in thread A regexp to parse nested brackets containing strings

Looks like I wasn't specific enough in my writeup. Yes, you can put a "^" anchor in the top-level invocation of $re, but not in the $re itself. For the OP's original problem, where he is looking for the innermost parenthesese that are not inside a quote, you want the "^L in the $re. If you don't put it there, the invocation of $re from within the first invocation of $re can just skip over text to find the parentheses within the quotes. However, "^" doesn't do what you need there, because it doesn't mean the beginning of where $re was invoked in each recursive iteration, it means the beginning of this invocation of the regex parser. At least that's what it looks like from the behavior.
  • Comment on Re^3: A regexp to parse nested brackets containing strings

Replies are listed 'Best First'.
Re^4: A regexp to parse nested brackets containing strings
by ikegami (Patriarch) on Sep 24, 2006 at 12:25 UTC

    If you don't put it there, the invocation of $re from within the first invocation of $re can just skip over text to find the parentheses within the quotes.

    No, it can't skip. That's what I was showing. If it could skip, all the regexp in my parent post would match, since they would skip over the !. When using (??{ $re }), matching $re is anchored at the current pos..