preg_match and accents (RESOLVED)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
FernandoBasso
Forum Newbie
Posts: 13
Joined: Sun Dec 05, 2010 4:05 am
Location: Brazil

preg_match and accents (RESOLVED)

Post 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".
Last edited by FernandoBasso on Wed Jun 06, 2012 11:19 am, edited 1 time in total.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: preg_match and accents

Post by Celauran »

Have you tried the u modifier for Unicode support?
Pattern modifiers
User avatar
FernandoBasso
Forum Newbie
Posts: 13
Joined: Sun Dec 05, 2010 4:05 am
Location: Brazil

Re: preg_match and accents

Post 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.
Post Reply