summaryrefslogtreecommitdiff
path: root/pod
diff options
context:
space:
mode:
authorMoritz Lenz <moritz@faui2k3.org>2009-11-27 00:33:09 +0100
committerRafael Garcia-Suarez <rgs@consttype.org>2009-11-28 18:35:31 +0100
commit408633379a1452b4e14d7c3b5e80f7dc05ea7986 (patch)
treec44763a814659f5e8eae84a48c2e8c898a4f19cc /pod
parent17c59fdf7540adaf656e96fe6d48b58dab391dc0 (diff)
downloadperl-408633379a1452b4e14d7c3b5e80f7dc05ea7986.tar.gz
Document backreferences to groups that did not match
Also add a test for that, fill in test description, and sneak in a vim modeline for re_tests
Diffstat (limited to 'pod')
-rw-r--r--pod/perlre.pod4
1 files changed, 4 insertions, 0 deletions
diff --git a/pod/perlre.pod b/pod/perlre.pod
index df627ff012..42017ddf66 100644
--- a/pod/perlre.pod
+++ b/pod/perlre.pod
@@ -518,6 +518,10 @@ backreference only if at least 11 left parentheses have opened
before it. And so on. \1 through \9 are always interpreted as
backreferences.
+If the bracketing group did not match, the associated backreference won't
+match either. (This can happen if the bracketing group is optional, or
+in a different branch of an alternation.)
+
X<\g{1}> X<\g{-1}> X<\g{name}> X<relative backreference> X<named backreference>
In order to provide a safer and easier way to construct patterns using
backreferences, Perl provides the C<\g{N}> notation (starting with perl