Tuesday 9 April 2013

Mysql email validator

This is a pretty simple, yet powerful, regexp to find invalid emails with mysql

SELECT `email`
FROM `users`
WHERE `email`
NOT REGEXP '[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}'
GROUP BY `email`

As seen here: http://stackoverflow.com/questions/2247266/mysql-valid-unique-e-mail