| Newsgroups |
perl.cvs.perlfaq |
| Message-ID |
<[email protected]> |
cvsuser 02/07/17 10:48:49
Modified: . perlfaq6.pod
Log:
* How can I make C<\w> match national character sets?
+ actually answered the question
* How can I match a locale-smart version of C</[a-zA-Z]/>?
+ added the POSIX solution
+ rewrote the answer to use both English and code ;)
Revision Changes Path
1.15 +15 -5 perlfaq/perlfaq6.pod
Index: perlfaq6.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq6.pod,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -w -r1.14 -r1.15
--- perlfaq6.pod 21 Jun 2002 04:37:21 -0000 1.14
+++ perlfaq6.pod 17 Jul 2002 17:48:49 -0000 1.15
@@ -1,6 +1,6 @@
=head1 NAME
-perlfaq6 - Regular Expressions ($Revision: 1.14 $, $Date: 2002/06/21 04:37:21 $)
+perlfaq6 - Regular Expressions ($Revision: 1.15 $, $Date: 2002/07/17 17:48:49 $)
=head1 DESCRIPTION
@@ -267,13 +267,23 @@
=head2 How can I make C<\w> match national character sets?
-See L<perllocale>.
+Put C<use locale;> in your script. The \w character class is taken
+from the current locale.
+
+See L<perllocale> for details.
=head2 How can I match a locale-smart version of C</[a-zA-Z]/>?
-One alphabetic character would be C</[^\W\d_]/>, no matter what locale
-you're in. Non-alphabetics would be C</[\W\d_]/> (assuming you don't
-consider an underscore a letter).
+You can use the POSIX character class syntax C</[[:alpha:]]/>
+documented in L<perlre>.
+
+No matter which locale you are in, the alphabetic characters are
+the characters in \w without the digits and the underscore.
+As a regex, that looks like C</[^\W\d_]/>. Its complement,
+the non-alphabetics, is then everything in \W along with
+the digits and the underscore, or C</[\W\d_]/>.
+
+You can also
=head2 How can I quote a variable to use in a regex?