summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-10-13 09:15:43 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-10-13 09:15:43 +0000
commit04838ceaee8e1344b7b5599b60f8b5fc6a1f385f (patch)
tree9e60f50dc925eb7fcf9190952e98f3dbc88b0080
parentb9b4dddfa592f0a0a9bfbbcc9a725253c5d991f1 (diff)
downloadperl-04838ceaee8e1344b7b5599b60f8b5fc6a1f385f.tar.gz
Fix nit in possessive quantifier descriptions.
Add some =head3 headings. p4raw-id: //depot/perl@29006
-rw-r--r--pod/perlre.pod18
1 files changed, 15 insertions, 3 deletions
diff --git a/pod/perlre.pod b/pod/perlre.pod
index c89d29f714..d78db381ff 100644
--- a/pod/perlre.pod
+++ b/pod/perlre.pod
@@ -82,6 +82,8 @@ X</x>
=head2 Regular Expressions
+=head3 Metacharacters
+
The patterns used in Perl pattern matching derive from supplied in
the Version 8 regex routines. (The routines are derived
(distantly) from Henry Spencer's freely redistributable reimplementation
@@ -119,6 +121,8 @@ newline unless you use the C</s> modifier, which in effect tells Perl to pretend
the string is a single line--even if it isn't.
X<.> X</s>
+=head3 Quantifiers
+
The following standard quantifiers are recognized:
X<metacharacter> X<quantifier> X<*> X<+> X<?> X<{n}> X<{n,}> X<{n,m}>
@@ -160,11 +164,11 @@ sometimes undesirable. Thus Perl provides the "possesive" quantifier form
as well.
*+ Match 0 or more times and give nothing back
- +? Match 1 or more times and give nothing back
+ ++ Match 1 or more times and give nothing back
?+ Match 0 or 1 time and give nothing back
{n}+ Match exactly n times and give nothing back (redundant)
- {n,}? Match at least n times and give nothing back
- {n,m}? Match at least n but not more than m times and give nothing back
+ {n,}+ Match at least n times and give nothing back
+ {n,m}+ Match at least n but not more than m times and give nothing back
For instance,
@@ -185,6 +189,8 @@ instance the above example could also be written as follows:
/"(?>(?:(?>[^"\\]+)|\\.)*)"/
+=head3 Escape sequences
+
Because patterns are processed as double quoted strings, the following
also work:
X<\t> X<\n> X<\r> X<\f> X<\a> X<\l> X<\u> X<\L> X<\U> X<\E> X<\Q>
@@ -217,6 +223,8 @@ An unescaped C<$> or C<@> interpolates the corresponding variable,
while escaping will cause the literal string C<\$> to be matched.
You'll need to write something like C<m/\Quser\E\@\Qhost/>.
+=head3 Character classes
+
In addition, Perl defines the following:
X<metacharacter>
X<\w> X<\W> X<\s> X<\S> X<\d> X<\D> X<\X> X<\p> X<\P> X<\C>
@@ -397,6 +405,8 @@ only supported within a character class. The POSIX character classes
[.cc.] and [=cc=] are recognized but B<not> supported and trying to
use them will cause an error.
+=head3 Assertions
+
Perl defines the following zero-width assertions:
X<zero-width assertion> X<assertion> X<regex, zero-width assertion>
X<regexp, zero-width assertion>
@@ -437,6 +447,8 @@ such uses (C</.\G/g>, for example) currently cause problems, and
it is recommended that you avoid such usage for now.
X<\G>
+=head3 Capture buffers
+
The bracketing construct C<( ... )> creates capture buffers. To
refer to the digit'th buffer use \<digit> within the
match. Outside the match use "$" instead of "\". (The