Tag Archives: mysql

MySQL Select query to validate email

MySQL supports another type of pattern matching operation based on the regular expressions, REGEXP operator used for pattern matching.

SELECT * FROM `users`,
WHERE `email` REGEXP '^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,63}$';

And now for your question of tracking multiple tables, you can use comma seperated table names right?

SELECT * FROM `users`, `customers`, `clients`
         WHERE `email` NOT REGEXP '^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,63}$';