Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: Unicode and Regexps: convert or am I missing something?

by thundergnat (Deacon)
on Jun 02, 2005 at 01:29 UTC ( [id://462715]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Unicode and Regexps: convert or am I missing something?
in thread Unicode and Regexps: convert or am I missing something?

UTF-16LE is supported by the Encoding module, so it should work... Did you try down converting it to Latin-1? The less often used encodings don't have as many aliases, you may need to be more careful about how the encoding is specified.

Encode::from_to($string, 'UTF-16LE', 'utf8');

should be ok, as should

Encode::from_to($string, 'UTF-16LE', 'iso-8859-1');

You only need to single escape the forward slash in the regex. (Or use alternate delimiters.)

my $string = '5/18/05 184 7 3.8% 6.14 1.13'; if ($string =~ m#(\p{Digit}+/\p{Digit}+/\p{Digit}+)#){ print $1; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://462715]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-24 16:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found