From: Paul Johnson Date: Sat, 10 Feb 2007 23:10:31 +0000 (+0100) Subject: Re: [PATCH - provisional] H. Merijn Brands idea of buffer numbering. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4deaaa807edd632ac36b986b1b622f1f9fb7673f;p=p5sagit%2Fp5-mst-13.2.git Re: [PATCH - provisional] H. Merijn Brands idea of buffer numbering. Message-ID: <20070210221031.GB31280@pjcj.net> p4raw-id: //depot/perl@30234 --- diff --git a/pod/perlre.pod b/pod/perlre.pod index 5287965..aa861ae 100644 --- a/pod/perlre.pod +++ b/pod/perlre.pod @@ -716,18 +716,23 @@ X<(?|)> X 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. +in each branch. It is available starting from perl 5.10. + +Normally capture buffers in a pattern are numbered sequentially, +from left to right. Inside this construct that behaviour is +overridden so that the capture buffers are shared between all the +branches and take their values from the branch that matched. + +The numbering within each branch will be as normal, and any buffers +following this construct will be numbered as though the construct +contained only one branch, that being the one with the most capture +buffers in it. + +This construct will be useful when you want to capture one of a +number of alternative matches. + +Consider the following pattern. The numbers underneath show in +which buffer the captured content will be stored. # before ---------------branch-reset----------- after