Alex Rivera | Logout

SELECT only rows that contain only alphanumeric characters in MySQL

Asked 2009-09-24T12:57:05.007
58

I'm trying to select all rows that contain only alphanumeric characters in MySQL using:

SELECT * FROM table WHERE column REGEXP '[A-Za-z0-9]';

However, it's returning all rows, regardless of the fact that they contain non-alphanumeric characters.

Edit
Report

1 Answer

4

Try this:

REGEXP '^[a-z0-9]+$'

As regexp is not case sensitive except for binary fields.

answered 2009-09-24T13:01:07.117

Your Answer