Page 1 of 1

Select rows where column contains character from list

Posted: 09 Jan 2015, 07:02
by MarPlo
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.

Select rows where column contains character from list

Posted: 09 Jan 2015, 07:09
by Admin
Try with REGEXP, and escape everything with backslash. Result: [\£\$\%\^\&\*\?].
SQL:

Code: Select all

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