Page 1 of 1

preg_match and accents (RESOLVED)

Posted: Wed Jun 06, 2012 9:04 am
by FernandoBasso
How can I make preg_match understand case sensitiveness for
accented characters. For example

This works:

Code: Select all

$s = 'Á test ...';

echo preg_match('/á/i', $s) ? 'Yes' : 'No';
But this doesn't (pay attention to "á" and "Á"):

Code: Select all

$s = 'á test ...';

echo preg_match('/Á/i', $s) ? 'Yes' : 'No';
It keeps showing "no".

Re: preg_match and accents

Posted: Wed Jun 06, 2012 9:42 am
by Celauran
Have you tried the u modifier for Unicode support?
Pattern modifiers

Re: preg_match and accents

Posted: Wed Jun 06, 2012 11:15 am
by FernandoBasso
Celauran wrote:Have you tried the u modifier for Unicode support?
Pattern modifiers

"u" did the trick. I'm reading the link now. Thank you.