diff options
author | Yves Orton <demerphq@gmail.com> | 2006-11-29 02:07:43 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-11-29 09:30:02 +0000 |
commit | 5624f11d89c15fde037a59d42ad53114f8b91abd (patch) | |
tree | 1ca98fc3774fd33edc2a52ebd078fe1db14323f5 /pod | |
parent | d6e4b61bc1b0f85e460abb04833aa4f8ece9a2d1 (diff) | |
download | perl-5624f11d89c15fde037a59d42ad53114f8b91abd.tar.gz |
Change in handling of \RNNN inside nested patterns
Subject: Re: New development release in sight
Message-ID: <9b18b3110611281607i3d583febtd549989dc3cabc8a@mail.gmail.com>
p4raw-id: //depot/perl@29413
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perlre.pod | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/pod/perlre.pod b/pod/perlre.pod index c1cc75d13c..bff63a6b98 100644 --- a/pod/perlre.pod +++ b/pod/perlre.pod @@ -483,15 +483,24 @@ ambiguity by interpreting \10 as a backreference only if at least 10 left parentheses have opened before it. Likewise \11 is a backreference only if at least 11 left parentheses have opened before it. And so on. \1 through \9 are always interpreted as -backreferences. +backreferences. X<relative backreference> In Perl 5.10 it is possible to relatively address a capture buffer by using the C<\RNNN> notation, where C<NNN> is negative offset to a -preceding completed capture buffer. Thus C<\R1> refers to the last -buffer closed, C<\R2> refers to the buffer before that, and so on. Note -especially that C</(foo)(\R1)/> refers to the capture buffer containing -C<foo>, not to the buffer containing C<\R1>. +preceding capture buffer. Thus C<\R1> refers to the last buffer, +C<\R2> refers to the buffer before that. For example: + + / + (Y) # buffer 1 + ( # buffer 2 + (X) # buffer 3 + \R1 # backref to buffer 3 + \R3 # backref to buffer 1 + ) + /x + +and would match the same as C</(Y) ( (X) $3 $1 )/x>. Additionally, as of Perl 5.10 you may use named capture buffers and named backreferences. The notation is C<< (?<name>...) >> and C<< \k<name> >> |