I have a strange issue with my MySQL REGEXP SELECT query, I'm trying to select rows which contain non-alphanumeric characters. I've tried multiple things and it will match Cyrillic characters, but it does not consider apostrophes and spaces to be non-alphanumeric. Here are the queries I've tried:
SELECT * FROM `table` WHERE `name` REGEXP '^[^[:alnum:]]+$' LIMIT 0,10;
SELECT * FROM `table` WHERE `name` REGEXP '^[^a-z0-9]+$' LIMIT 0,10;
They both return nothing at all now because I've replaced all of the Cyrillic characters, except for spaces and apostrophes. I feel as though I must be doing something incorrectly, because it seems so illogical that MySQL would consider a space and apostrophe to be alphanumeric.
Have you tried:
SELECT * FROM table WHERE name REGEXP "[^a-z0-9]+" LIMIT 0,10;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With