Link to home
Start Free TrialLog in
Avatar of CtrlAltDl
CtrlAltDlFlag for United States of America

asked on

Strip non-alphanumeric except spanish characters.

I'm currently strip all non-alphanumeric characters from a string in PHP like this:
preg_replace("/\W/","",$strText)

I'd like to change it so it doesn't strip spanish characters.

FYI, my server's locale is english-us.

The spanish characters I don't want to strip include:
[ÁáÉéÍíÑñÓóÚúÜü«»¿¡€P]

In hexadecimal they'd be:
[\xC1\xE1\xC9\xE9\xCD\xED\xD1\xF1\xD3\xF3\xDA\xFA\xDC\xFC\xAB\xBB\xBF\xA1\x80\x20A7]
ASKER CERTIFIED SOLUTION
Avatar of Superdave
Superdave
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CtrlAltDl

ASKER

I got to do a little more testing on it, but I think this is meeting my needs.
Unfortunately I still haven't tested it thoroughly, but I didn't want to leave this question open any longer.  Thanks for your response!