Select rows where column contains character from list

Discuss coding issues, and scripts related to PHP and MySQL.
MarPlo
Posts:186

Select rows where column contains character from list

I am trying to select all rows from a table where column contains a character from a list: Something like:

Code: Select all

SELECT * FROM table WHERE column (contains anything from {£,$,%,^,&,*,/} )
This is basically an illegal character check.
Can anyone help?
Thanks.

Admin Posts:805
Try with REGEXP, and escape everything with backslash. Result: [\£\$\%\^\&\*\?].
SQL:

Code: Select all

SELECT * FROM table WHERE column REGEXP '[\£\$\%\^\&\*\?]'