diff options
author | Paul Johnson <paul@pjcj.net> | 2007-02-11 00:10:31 +0100 |
---|---|---|
committer | H.Merijn Brand <h.m.brand@xs4all.nl> | 2007-02-12 17:46:46 +0000 |
commit | 4deaaa807edd632ac36b986b1b622f1f9fb7673f (patch) | |
tree | 1b715941862d191c4820367796f7ba1ba77938c2 /pod/perlre.pod | |
parent | 771ed9f1af61a5ebf694942246ba6240a0a817ce (diff) | |
download | perl-4deaaa807edd632ac36b986b1b622f1f9fb7673f.tar.gz |
Re: [PATCH - provisional] H. Merijn Brands idea of buffer numbering.
Message-ID: <20070210221031.GB31280@pjcj.net>
p4raw-id: //depot/perl@30234
Diffstat (limited to 'pod/perlre.pod')
-rw-r--r-- | pod/perlre.pod | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/pod/perlre.pod b/pod/perlre.pod index 5287965fe3..aa861ae46e 100644 --- a/pod/perlre.pod +++ b/pod/perlre.pod @@ -716,18 +716,23 @@ 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. +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 |