Validate email directly from sql query


  • snippets
  • (Updated at )

Deal with garbage email address all the time?

Get valid email by query:

SELECT email   
FROM users   
WHERE   
    email REGEXP ‘^[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]@[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]\.[a-zA-Z]{2,4}$’  

or invalid email by NOT REGEXP syntax

0 comment, 0 pingback