At 23:51 -0400 on 05/11/2004, Michael Stassen wrote about Re: check for certain characters:

Then you could add NOT to Paul's query:

SELECT * FROM your table WHERE sequence NOT REGEXP '^[atcg]+$';

or, equivalently,

SELECT * FROM your table WHERE sequence REGEXP '[^atcg]';

I suspect the latter may be faster, but you'd have to try them to be sure.

Note that pattern matching in mysql is case-insensitive by default. If that matters to you, then you would need to add the BINARY keyword to the WHERE clause:

WHERE sequence NOT REGEXP BINARY '^[atcg]+$';

or

WHERE sequence REGEXP BINARY '[^atcg]';

Michael

The need to go BINARY to detect case also requires that sequence be a BLOB not a TEXT field (I might have the case-sensitive/case-insensitive types reversed),


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to