summaryrefslogtreecommitdiff
path: root/pod
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2006-10-09 22:36:20 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-10-10 13:13:18 +0000
commit894be9b73be0493c898492f5cfad130c681ee44d (patch)
tree556ef209a1ccfa2e8d3ef32487b9fa480ae1078e /pod
parent6e8dae779caa61392088d43ba93888dc57f1df7e (diff)
downloadperl-894be9b73be0493c898492f5cfad130c681ee44d.tar.gz
Regexp Recurse by name.
Message-ID: <9b18b3110610091136g48e5b154tf16d00d38e80a6dc@mail.gmail.com> (with doc nits) p4raw-id: //depot/perl@28981
Diffstat (limited to 'pod')
-rw-r--r--pod/perlre.pod22
1 files changed, 16 insertions, 6 deletions
diff --git a/pod/perlre.pod b/pod/perlre.pod
index 7cc5decc22..a22344fe4b 100644
--- a/pod/perlre.pod
+++ b/pod/perlre.pod
@@ -820,9 +820,8 @@ Recursing deeper than 50 times without consuming any input string will
result in a fatal error. The maximum depth is compiled into perl, so
changing it requires a custom build.
-=item C<(?PARNO)> C<(?R)>
-
-X<(?PARNO)> X<(?1)>
+=item C<(?PARNO)> C<(?R)> C<(?0)>
+X<(?PARNO)> X<(?1)> X<(?R)> X<(?0)>
X<regex, recursive> X<regexp, recursive> X<regular expression, recursive>
B<WARNING>: This extended regular expression feature is considered
@@ -834,9 +833,10 @@ pattern that must match at the current position. Capture buffers
contained by the pattern will have the value as determined by the
outermost recursion.
-PARNO is a sequence of digits not starting with 0 whose value
-reflects the paren-number of the capture buffer to recurse to.
-C<(?R)> curses to the beginning of the pattern.
+PARNO is a sequence of digits (not starting with 0) whose value reflects
+the paren-number of the capture buffer to recurse to. C<(?R)> recurses to
+the beginning of the whole pattern. C<(?0)> is an alternate syntax for
+C<(?R)>.
The following pattern matches a function foo() which may contain
balanced parenthesis as the argument.
@@ -881,6 +881,16 @@ a recursed group, in PCRE and Python the recursed into group is treated
as atomic. Also, constructs like (?i:(?1)) or (?:(?i)(?1)) do not affect
the pattern being recursed into.
+=item C<(?&NAME)>
+X<(?&NAME)>
+
+Recurse to a named subpattern. Identical to (?PARNO) except that the
+parenthesis to recurse to is determined by name. If multiple parens have
+the same name, then it recurses to the leftmost.
+
+It is an error to refer to a name that is not declared somewhere in the
+pattern.
+
=item C<< (?>pattern) >>
X<backtrack> X<backtracking> X<atomic> X<possessive>