Jump to content
xisto Community
mizako

Matching Accents In Perl Regular Expresions matching accents in perl regular expresi

Recommended Posts

Does anyone knows how can i match accents in perl regular expresions. I do not manage to match not english characaters such as ?, ? or ?. I hope there is someone taht knows the answer because i have been searching in google a long time without success. Thanks in advanced

Share this post


Link to post
Share on other sites

Does anyone knows how can i match accents in perl regular expresions. I do not manage to match not english characaters such as á, é or ń.
I hope there is someone taht knows the answer because i have been searching in google a long time without success.
Thanks in advanced


According to the Perl tutorial, the current character set is ASCII, and characters within the set can be searched.

The term, language, when used in the sense borrowed from automata theory, can be a bit confusing. A language in automata theory is simply some (possibly infinite) set of strings. Each string (which can be possibly empty) is composed of a set of characters from a fixed, finite set. In our case, this set will be all the possible ASCII characters10.

and note 10 says

Perl will eventually support unicode, or some other extended character format, in which case it will no longer merely be ASCII characters.

For curiosity, I gave it a try, and the following code works with accented character ŕ (alt-133).

if($line1 =~ m'ŕ'i){printf("ŕ is in %s\n",$line1);} linenums:0'>$line ="ABCDE";$line1="ŕbcdé";if($line =~ m'a'i){printf("a is in %s\n",$line);}if($line1 =~ m'ŕ'i){printf("ŕ is in %s\n",$line1);}
and the result is:

a is in ABCDEŕ is in ŕbcdéTool completed successfully

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.