summaryrefslogtreecommitdiff
path: root/pod/perlre.pod
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2007-02-07 23:53:25 +0100
committerH.Merijn Brand <h.m.brand@xs4all.nl>2007-02-08 08:19:24 +0000
commit594d70332e6d7552f1cb2180b59e1c78bea05ea1 (patch)
tree8a62a59501446e5926c3bc22711847aefc5c9a80 /pod/perlre.pod
parentabb7fb969e178cc19fea40a236916e588c666f16 (diff)
downloadperl-594d70332e6d7552f1cb2180b59e1c78bea05ea1.tar.gz
Re: [PATCH - provisional] H. Merijn Brands idea of buffer numbering.
Message-ID: <9b18b3110702071353l250d8a67x188c4e234e8905c7@mail.gmail.com> p4raw-id: //depot/perl@30169
Diffstat (limited to 'pod/perlre.pod')
-rw-r--r--pod/perlre.pod23
1 files changed, 23 insertions, 0 deletions
diff --git a/pod/perlre.pod b/pod/perlre.pod
index d913c8074a..5287965fe3 100644
--- a/pod/perlre.pod
+++ b/pod/perlre.pod
@@ -711,6 +711,29 @@ is equivalent to the more verbose
/(?:(?s-i)more.*than).*million/i
+=item C<(?|pattern)>
+X<(?|)> X<Branch reset>
+
+This is the "branch reset" pattern, which has the special property
+that the capture buffers are numbered from the same starting point
+in each branch.
+
+Normally capture buffers in a pattern are number sequentially, left
+to right in the pattern. Inside of this construct this behaviour is
+overriden so that the captures buffers in each branch share the same
+numbers. The numbering in each branch will be as normal, and any
+buffers following the use of this pattern will be numbered as though
+the construct contained only one branch, that being the one with the
+most capture buffers in it.
+
+Consider the following pattern. The numbers underneath are which
+buffer number the captured content will be stored in.
+
+
+ # before ---------------branch-reset----------- after
+ / ( a ) (?| x ( y ) z | (p (q) r) | (t) u (v) ) ( z ) /x
+ # 1 2 2 3 2 3 4
+
=item Look-Around Assertions
X<look-around assertion> X<lookaround assertion> X<look-around> X<lookaround>