Hi Merlin,

I think the pattern you're looking for is '/[a-zA-Z0-9]/' which will match all alphanumeric characters.



On 30 Jul 2009, at 19:13, Merlin Morgenstern wrote:

Hi there,

I am trying to filter out content that is not ascii. Can I do this with regex? For example:

        $regex = '[AZ][09]';
        if (preg_match($regex, $text)) {
                return TRUE;
        else {
                return FALSE;

The reason I need to do this is that I am doing a mysql query with the text and I need to make sure it is not UTF8. Otherwise I do get following error:

Error: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='

I am new to regex and would be happy for a jump start to get this fixed.

Best regards, Merlin

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to