summaryrefslogtreecommitdiff
path: root/pod/perlretut.pod
diff options
context:
space:
mode:
authorMark Kvale <kvale@phy.ucsf.edu>2002-03-27 08:45:37 -0800
committerJarkko Hietaniemi <jhi@iki.fi>2002-03-27 23:50:23 +0000
commit54c18d0455d4f9550786bea467f5a04c96e86890 (patch)
tree6d587bcbd65648da33ad25d1350c02387264a023 /pod/perlretut.pod
parentef4a39e599a07c97b0213b41bfa69f4a6f4a17ed (diff)
downloadperl-54c18d0455d4f9550786bea467f5a04c96e86890.tar.gz
[DOC PATCH] Regex \G and POSIX restrictions
Message-Id: <02032716453705.38063@ivy.ucsf.edu> p4raw-id: //depot/perl@15562
Diffstat (limited to 'pod/perlretut.pod')
-rw-r--r--pod/perlretut.pod6
1 files changed, 4 insertions, 2 deletions
diff --git a/pod/perlretut.pod b/pod/perlretut.pod
index e90e03d602..8c12a5cfba 100644
--- a/pod/perlretut.pod
+++ b/pod/perlretut.pod
@@ -1403,6 +1403,7 @@ off. C<\G> allows us to easily do context-sensitive matching:
The combination of C<//g> and C<\G> allows us to process the string a
bit at a time and use arbitrary Perl logic to decide what to do next.
+Currently, the C<\G> anchor only works at the beginning of a pattern.
C<\G> is also invaluable in processing fixed length records with
regexps. Suppose we have a snippet of coding region DNA, encoded as
@@ -1782,10 +1783,11 @@ C<[:space:]> correspond to the familiar C<\d>, C<\w>, and C<\s>
character classes. To negate a POSIX class, put a C<^> in front of
the name, so that, e.g., C<[:^digit:]> corresponds to C<\D> and under
C<utf8>, C<\P{IsDigit}>. The Unicode and POSIX character classes can
-be used just like C<\d>, both inside and outside of character classes:
+be used just like C<\d>, with the exception that POSIX character
+classes can only be used inside of a character class:
/\s+[abc[:digit:]xyz]\s*/; # match a,b,c,x,y,z, or a digit
- /^=item\s[:digit:]/; # match '=item',
+ /^=item\s[[:digit:]]/; # match '=item',
# followed by a space and a digit
use charnames ":full";
/\s+[abc\p{IsDigit}xyz]\s+/; # match a,b,c,x,y,z, or a digit