summaryrefslogtreecommitdiff
path: root/pod/perlfaq6.pod
diff options
context:
space:
mode:
authorDaniel Chetlin <daniel@chetlin.com>2000-09-04 21:57:07 -0700
committerJarkko Hietaniemi <jhi@iki.fi>2000-09-07 18:45:35 +0000
commit5d43e42d71f64cebb856e08f031cf1e743bf3445 (patch)
tree9e3f247fff91b84fd60bc361cec87bdccd759fa6 /pod/perlfaq6.pod
parentc9e9bc25160ffe8088b7a1fcb3ea915c28efb60f (diff)
downloadperl-5d43e42d71f64cebb856e08f031cf1e743bf3445.tar.gz
\G in non-/g is well-defined now ... right?
Message-ID: <20000905045707.A8620@ilmd.chetlin.org> p4raw-id: //depot/perl@7027
Diffstat (limited to 'pod/perlfaq6.pod')
-rw-r--r--pod/perlfaq6.pod15
1 files changed, 10 insertions, 5 deletions
diff --git a/pod/perlfaq6.pod b/pod/perlfaq6.pod
index 29136abd96..4ab4d4cc98 100644
--- a/pod/perlfaq6.pod
+++ b/pod/perlfaq6.pod
@@ -527,11 +527,16 @@ variable is no longer "expensive" the way the other two are.
=head2 What good is C<\G> in a regular expression?
-The notation C<\G> is used in a match or substitution in conjunction the
-C</g> modifier (and ignored if there's no C</g>) to anchor the regular
-expression to the point just past where the last match occurred, i.e. the
-pos() point. A failed match resets the position of C<\G> unless the
-C</c> modifier is in effect.
+The notation C<\G> is used in a match or substitution in conjunction with
+the C</g> modifier to anchor the regular expression to the point just past
+where the last match occurred, i.e. the pos() point. A failed match resets
+the position of C<\G> unless the C</c> modifier is in effect. C<\G> can be
+used in a match without the C</g> modifier; it acts the same (i.e. still
+anchors at the pos() point) but of course only matches once and does not
+update pos(), as non-C</g> expressions never do. C<\G> in an expression
+applied to a target string that has never been matched against a C</g>
+expression before or has had its pos() reset is functionally equivalent to
+C<\A>, which matches at the beginning of the string.
For example, suppose you had a line of text quoted in standard mail
and Usenet notation, (that is, with leading C<< > >> characters), and