X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlfaq6.pod;h=c4512e695afb7159754713bcb9f2cc686a24fbe1;hb=5cb3728cfe288ad05e8d10c8176f72378da2238f;hp=4a52259800e8a661624cb5fc8025cd1d70769396;hpb=8305e449a259649641f455b333f66bc0de7f3b62;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlfaq6.pod b/pod/perlfaq6.pod index 4a52259..c4512e6 100644 --- a/pod/perlfaq6.pod +++ b/pod/perlfaq6.pod @@ -1,6 +1,6 @@ =head1 NAME -perlfaq6 - Regexes ($Revision: 1.3 $, $Date: 2001/10/16 13:27:22 $) +perlfaq6 - Regular Expressions ($Revision: 1.8 $, $Date: 2002/01/31 04:27:55 $) =head1 DESCRIPTION @@ -218,10 +218,10 @@ longer than the original, you can use this code, by Jeff Pinyan: sub preserve_case { my ($from, $to) = @_; my ($lf, $lt) = map length, @_; - + if ($lt < $lf) { $from = substr $from, 0, $lt } else { $from .= substr $to, $lf } - + return uc $to | ($from ^ uc $from); } @@ -404,7 +404,7 @@ are many others. An elaborate subroutine (for 7-bit ASCII only) to pull out balanced and possibly nested single chars, like C<`> and C<'>, C<{> and C<}>, or C<(> and C<)> can be found in -http://www.perl.com/CPAN/authors/id/TOMC/scripts/pull_quotes.gz . +http://www.cpan.org/authors/id/TOMC/scripts/pull_quotes.gz . The C::Scan module from CPAN also contains such subs for internal use, but they are undocumented. @@ -641,11 +641,20 @@ programming language, you insensitive scoundrel! =head2 How can I match strings with multibyte characters? -This is hard, and there's no good way. Perl does not directly support -wide characters. It pretends that a byte and a character are -synonymous. The following set of approaches was offered by Jeffrey -Friedl, whose article in issue #5 of The Perl Journal talks about this -very matter. +Starting from Perl 5.6 Perl has had some level of multibyte character +support. Perl 5.8 or later is recommended. Supported multibyte +character repertoires include Unicode, and legacy encodings +through the Encode module. See L, L, +and L. + +If you are stuck with older Perls, you can do Unicode with the +C module, and character conversions using the +C and C modules. If you are using +Japanese encodings, you might try using the jperl 5.005_03. + +Finally, the following set of approaches was offered by Jeffrey +Friedl, whose article in issue #5 of The Perl Journal talks about +this very matter. Let's suppose you have some weird Martian encoding where pairs of ASCII uppercase letters encode single Martian letters (i.e. the two @@ -719,7 +728,7 @@ in L. =head1 AUTHOR AND COPYRIGHT -Copyright (c) 1997-1999 Tom Christiansen and Nathan Torkington. +Copyright (c) 1997-2002 Tom Christiansen and Nathan Torkington. All rights reserved. This documentation is free; you can redistribute it and/or modify it