Multilanguage

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Multilanguage

Post by Ree »

How do you solve multilanguage problem when using regex? For example name validation pattern

Code: Select all

$pattern = '#^[a-ząčęėįšųūž]+$#i';
simply won't work: if it's a-z what's entered, it works. If it contains any of the language specific characters (čęėįšųūž), it doesn't. Does that mean I will not be able to write a proper regex to validate my language names? Is there a solution?

EDIT: it seems the chars got converted to &#stuff;. :roll:
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

I believe there is a 'u' modifier that enables unicode characters in the re (http://be.php.net/manual/en/reference.p ... ifiers.php)
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Post by Ree »

Thanks timvw, that did the trick. :)
Post Reply