in reply to how to go from numbered captures to named?
(\q<R>): Is that a typo in your post, or are you using \q<R> when you mean \g<R>? ...or do I just not know about the \q<NAME> backreferencing metacharacter? (I'm never confident that I know all of the possible metacharacters for regular expressions. ;)
Isn't it a problem that you're backreferencing a capture group while still inside of it? I don't know for sure, but it seems funky. When I try a minimal example:
(?<name>a.*?\g<name>)
Perl fails to compile the regex.
I also get a failure to compile when I try your last example (after fixing the \q<name> vs \g<name> issue). I really think that trying to access a backreference while in the capture group that created it is asking for trouble.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to go from numbered captures to named?
by perl-diddler (Chaplain) on Jul 15, 2012 at 23:01 UTC |