The PCRE section in the PHP manual says about \w (any word character):
So PCRE’s escape sequence \w should actually include locale-specific characters (like Ä, Ö, Ü in german) if the right locale is set. I tried to call setlocale(LC_ALL,‘de’) before i use this ‘match’ validator:
array('name','match','pattern'=>'/^\w+$/i'),
But it still doesn’t accept german umlauts. So any idea how to enable locale-specific character classes?
/* try different possible locale names for german as of PHP 4.3.0 */
$loc_de = setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
echo "Preferred locale for german on this system is '$loc_de'";
For me it outputs
So this way you can obviously make sure the correct locale was selected.
Regarding the regex, you have to add u modifier I think:
array('name','match','pattern'=>'/^\w+$/iu'),
If there are still any problems try putting this in the entry script (not sure if it helps though):
An alternative can be unicode character properties. They are locale independent, though. Still very useful, if you want to match e.g. any possible letter character in any language.