Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

2 problems withs regexes and letters like é

by Sihal (Pilgrim)
on Jan 16, 2003 at 15:42 UTC ( [id://227395]=perlquestion: print w/replies, xml ) Need Help??

Sihal has asked for the wisdom of the Perl Monks concerning the following question:

Fellow monks,
My first problem is that I would like to match stuff as "é", "à", you know, all this accentuated characters we frog-eaters use ;-)
Well, I can't seem to find the character classes for these.
Here is my two tries, condensed in the same regex:
/^[-'\.\s\w\p{IsWord}\p{IsL}\p{InLatinExtended-A}]+$/
Moreover, and more surprising, this regex causes the following error:
nvalid [] range "d-A" in regexp at
Thanks a lot for the help

Replies are listed 'Best First'.
Re: 2 problems withs regexes and letters like é
by Fletch (Bishop) on Jan 16, 2003 at 18:01 UTC

    I don't know if this specifically addresses your problem, but check out perldoc perllocale for information on POSIX locale support in perl. I'm pretty sure it covers on how the locale setting interacts with character classes and what not.

      It seems (I'm not through reading the manpage yet but I start to have a good idea of what is going on) that this will solve my problem. Thanks a lot.
      # Solution for matching "é" use locale ; my $test = "é é é é " ; $test =~ /[[:alpha:]]/ and print "YEAH" ; #OR $test =~ /[\w]/ and print "Thanx" ;
      Simple for some, hard for me since I didn't even knew of localization.

      Thank you Fletch! ( and diotalevi and jdporter who answered in the CB. )
      Ill have a look thanx. Not coming from a computer science, I wasn't aware of locale POSIX

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2025-02-16 12:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found