develooper Front page | perl.perl5.porters | Postings from July 2001

Re: [ID 20010626.005] regex (?<name>...) capture-to-var paren, new$^N magic variable

From:
Jeff 'japhy/Marillion' Pinyan
Date:
July 26, 2001 16:55
Subject:
Re: [ID 20010626.005] regex (?<name>...) capture-to-var paren, new$^N magic variable
Message ID:
Pine.GSO.4.21.0107261953500.28213-100000@crusoe.crusoe.net
On Jun 30, Jeffrey Friedl said:

>+so that if the regexp matched, e.g., C<$2> would contain 'cd' or 'ef'. For
>+convenience, perl sets C<$+> to the string held by the highest numbered
>+C<$1>, C<$2>, ... that got assigned (and, somewhat related, C<$^N> to the
>+value of the C<$1>, C<$2>, ... most-recently assigned; i.e. the C<$1>,
>+C<$2>, ... associated with the rightmost closing parenthesis used in the
>+match).

Does that make $^N equal to

  substr(???, $-[-1], $+[-1] - $-[-1]);

If so, you might want to include that in the docs for @- and/or @+.

-- 
Jeff "japhy" Pinyan      japhy@pobox.com      http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl Regex book      **




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About