I've read how accented characters might sometimes match [a-z]. What I'd like to know is how I could match a specific accented character. Obviously, preg_match('/[ñ]/', 'ñ')
does not work.
views:
64answers:
2
+6
A:
Use the /u modifier. That will enable Unicode for the regexes. http://php.net/manual/en/reference.pcre.pattern.modifiers.php
Jimmie Lin
2010-02-12 08:55:51
Thanks! This works on my Ubuntu workstation but, unfortunately, it doesn't work on my teammate's Windows XP workstation.
Nikki Erwin Ramirez
2010-02-12 09:05:18
This might be a PHP incompatibility with Windows, not sure.
Jimmie Lin
2010-02-12 09:13:38
Hmm. Finally got it to work. Had to simplify the expression to use the shorthand `\w` but with the `/u` modifier: `preg_match('/[\w]/iu', 'ñ');` works!
Nikki Erwin Ramirez
2010-02-12 09:39:12
A:
You can take their codes and match them like \xD0 - heximal sequences if accented symbols are not accepted
FractalizeR
2010-02-12 09:15:19