summaryrefslogtreecommitdiff
path: root/pod/perlre.pod
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2007-02-13 23:04:54 +0100
committerH.Merijn Brand <h.m.brand@xs4all.nl>2007-02-14 07:54:59 +0000
commit87e95b7ff3268cc4f947098ed09d244372b3af0d (patch)
tree558694850b849d198a69d4f0111e9706388c2d9f /pod/perlre.pod
parentee03edd30dac4a70bf2d56895e9bf4dd1243abc8 (diff)
downloadperl-87e95b7ff3268cc4f947098ed09d244372b3af0d.tar.gz
Re: [PATCH] Document that m//k works
Message-ID: <9b18b3110702131304q370f3530j463c1a59c5ac1dfe@mail.gmail.com> p4raw-id: //depot/perl@30278
Diffstat (limited to 'pod/perlre.pod')
-rw-r--r--pod/perlre.pod28
1 files changed, 17 insertions, 11 deletions
diff --git a/pod/perlre.pod b/pod/perlre.pod
index aa861ae46e..99cba6889e 100644
--- a/pod/perlre.pod
+++ b/pod/perlre.pod
@@ -27,15 +27,6 @@ L<perlop/"Gory details of parsing quoted constructs">.
=over 4
-=item i
-X</i> X<regex, case-insensitive> X<regexp, case-insensitive>
-X<regular expression, case-insensitive>
-
-Do case-insensitive pattern matching.
-
-If C<use locale> is in effect, the case map is taken from the current
-locale. See L<perllocale>.
-
=item m
X</m> X<regex, multiline> X<regexp, multiline> X<regular expression, multiline>
@@ -54,11 +45,26 @@ Used together, as /ms, they let the "." match any character whatsoever,
while still allowing "^" and "$" to match, respectively, just after
and just before newlines within the string.
+=item i
+X</i> X<regex, case-insensitive> X<regexp, case-insensitive>
+X<regular expression, case-insensitive>
+
+Do case-insensitive pattern matching.
+
+If C<use locale> is in effect, the case map is taken from the current
+locale. See L<perllocale>.
+
=item x
X</x>
Extend your pattern's legibility by permitting whitespace and comments.
+=item p
+X</p> X<regex, preserve> X<regexp, preserve>
+
+Preserve the string matched such that ${^PREMATCH}, {$^MATCH}, and
+${^POSTMATCH} are available for use after matching.
+
=back
These are usually written as "the C</x> modifier", even though the delimiter
@@ -593,11 +599,11 @@ X<$&> X<$`> X<$'>
As a workaround for this problem, Perl 5.10 introduces C<${^PREMATCH}>,
C<${^MATCH}> and C<${^POSTMATCH}>, which are equivalent to C<$`>, C<$&>
and C<$'>, B<except> that they are only guaranteed to be defined after a
-successful match that was executed with the C</k> (keep-copy) modifier.
+successful match that was executed with the C</p> (preserve) modifier.
The use of these variables incurs no global performance penalty, unlike
their punctuation char equivalents, however at the trade-off that you
have to tell perl when you want to use them.
-X</k> X<k modifier>
+X</p> X<p modifier>
Backslashed metacharacters in Perl are alphanumeric, such as C<\b>,
C<\w>, C<\n>. Unlike some other regular expression languages, there