Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL: Select row where column contains element from list

Tags:

sql

php

mysql

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

Select * from `table` where `column` (contains anything from {£,$,%,^,&,...,/})

This is basically an illegal character check.

Can anyone help?

Thanks

like image 683
Iain Fifer Avatar asked Apr 16 '13 09:04

Iain Fifer


1 Answers

For MySQL you may use REGEXP or RLIKE to check specific column for pattern matching. In your case following example might work:

SELECT * FROM `table` WHERE `column` REGEXP '[\£\$\%\^\&]';
like image 173
BlitZ Avatar answered Oct 01 '22 00:10

BlitZ