diff options
author | Yves Orton <demerphq@gmail.com> | 2007-02-07 23:53:25 +0100 |
---|---|---|
committer | H.Merijn Brand <h.m.brand@xs4all.nl> | 2007-02-08 08:19:24 +0000 |
commit | 594d70332e6d7552f1cb2180b59e1c78bea05ea1 (patch) | |
tree | 8a62a59501446e5926c3bc22711847aefc5c9a80 /pod | |
parent | abb7fb969e178cc19fea40a236916e588c666f16 (diff) | |
download | perl-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')
-rw-r--r-- | pod/perlre.pod | 23 |
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> |