Click here to get back home

regexp for accented characters

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
regexp for accented characters Petr Vileta 02-19-2008
Posted by Petr Vileta on February 19, 2008, 11:21 am
Please log in for more thread options
I have string in cp1250 codepage and I need to use regexp to extract part of
string. All is simple but I want to run the same script under Perl 5.6.1 and
5.8. And here is the problem.

Example 1
-------------
require utf8 if($] > 5.006001);
$string = "Telefón: 123456789\nFax: 123456789";
$string =~ m/Telef.n:\s+(\d+)\s+Fax:\s+(\d+)/
my ($phone,$fax) = ($1,$2);

This work for Perl 5.6.1 but fail for Perl 5.8. For Perl 5.8 I must write
regexp as

$string =~ m/Telef.+?n:\s+(\d+)\s+Fax:\s+(\d+)/

This modified regexp work for 5.6.1 too but is not clear because possible can
acept string "Telefóon..." too.
Please can anybody describe me how regexp works under Perl 5.8 and "use utf8"
?
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail from
another non-spammer site please.)

Please reply to <petr AT practisoft DOT cz>


Similar ThreadsPosted
xml xsl and accented characters June 2, 2005, 9:48 am
Dealing with accented characters June 8, 2006, 10:44 am
regexp to replace some number of characters? May 22, 2008, 4:49 am
How to "quote" all regexp expression special characters? June 6, 2006, 1:36 pm
finding & saving accented (unicode) chars with perl 5.6.1 May 21, 2008, 7:57 am
Adding a delimiter inbetween number characters and letter characters January 12, 2005, 9:25 am
what to do with special characters like "é","ë",... November 11, 2004, 5:14 pm
Delete characters April 20, 2005, 3:51 pm
[FR/EN] how to remove the characters '-' September 19, 2005, 12:15 am
characters to ascii March 28, 2006, 10:24 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap