Add test for grep() and wantarray
[p5sagit/p5-mst-13.2.git] / pod / perlre.pod
index c395250..cb3ce03 100644 (file)
@@ -19,6 +19,9 @@ the regular expression inside.  These are:
 
 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   
 
 Treat string as multiple lines.  That is, change "^" and "$" from matching
@@ -80,7 +83,7 @@ string as a multi-line buffer, such that the "^" will match after any
 newline within the string, and "$" will match before any newline.  At the
 cost of a little more overhead, you can do this by using the /m modifier
 on the pattern match operator.  (Older programs did this by setting C<$*>,
-but this practice is deprecated in Perl 5.)
+but this practice is now deprecated.)
 
 To facilitate multi-line substitutions, the "." character never matches a
 newline unless you use the C</s> modifier, which in effect tells Perl to pretend
@@ -136,6 +139,9 @@ also work:
     \E         end case modification (think vi)
     \Q         quote regexp metacharacters till \E
 
+If C<use locale> is in effect, the case map used by C<\l>, C<\L>, C<\u>
+and <\U> is taken from the current locale.  See L<perllocale>.
+
 In addition, Perl defines the following:
 
     \w Match a "word" character (alphanumeric plus "_")
@@ -146,9 +152,11 @@ In addition, Perl defines the following:
     \D Match a non-digit character
 
 Note that C<\w> matches a single alphanumeric character, not a whole
-word.  To match a word you'd need to say C<\w+>.  You may use C<\w>,
-C<\W>, C<\s>, C<\S>, C<\d> and C<\D> within character classes (though not
-as either end of a range).
+word.  To match a word you'd need to say C<\w+>.  If C<use locale> is in
+effect, the list of alphabetic characters generated by C<\w> is taken
+from the current locale.  See L<perllocale>. You may use C<\w>, C<\W>,
+C<\s>, C<\S>, C<\d>, and C<\D> within character classes (though not as
+either end of a range).
 
 Perl defines the following zero-width assertions:
 
@@ -166,7 +174,14 @@ represents backspace rather than a word boundary.)  The C<\A> and C<\Z> are
 just like "^" and "$" except that they won't match multiple times when the
 C</m> modifier is used, while "^" and "$" will match at every internal line
 boundary.  To match the actual end of the string, not ignoring newline,
-you can use C<\Z(?!\n)>.
+you can use C<\Z(?!\n)>.  The C<\G> assertion can be used to mix global
+matches (using C<m//g>) and non-global ones, as described in 
+L<perlop/"Regexp Quote-Like Operators">.
+It is also useful when writing C<lex>-like scanners, when you have several
+regexps which you want to match against consequent substrings of your
+string, see the previous reference.
+The actual location where C<\G> will match can also be influenced
+by using C<pos()> as an lvalue.  See L<perlfunc/pos>.
 
 When the bracketing construct C<( ... )> is used, \E<lt>digitE<gt> matches the
 digit'th substring.  Outside of the pattern, always use "$" instead of "\"
@@ -216,11 +231,11 @@ is to say
 
     /$unquoted\Q$quoted\E$unquoted/
 
-Perl 5 defines a consistent extension syntax for regular expressions.
-The syntax is a pair of parentheses with a question mark as the first thing
-within the parentheses (this was a syntax error in Perl 4).  The character
-after the question mark gives the function of the extension.  Several
-extensions are already supported:
+Perl defines a consistent extension syntax for regular expressions.
+The syntax is a pair of parentheses with a question mark as the first
+thing within the parentheses (this was a syntax error in older
+versions of Perl).  The character after the question mark gives the
+function of the extension.  Several extensions are already supported:
 
 =over 10
 
@@ -531,7 +546,7 @@ Some people get too used to writing things like
 
 This is grandfathered for the RHS of a substitute to avoid shocking the
 B<sed> addicts, but it's a dirty habit to get into.  That's because in
-PerlThink, the right-hand side of a C<s///> is a double-quoted string.  C<\1> in
+PerlThink, the righthand side of a C<s///> is a double-quoted string.  C<\1> in
 the usual double-quoted string means a control-A.  The customary Unix
 meaning of C<\1> is kludged in for C<s///>.  However, if you get into the habit
 of doing that, you get yourself into trouble if you then add an C</e>