Last active
December 19, 2015 21:58
-
-
Save AngeloMerlo/6023907 to your computer and use it in GitHub Desktop.
DRY - seleciona os emails válidos ou não do banco de dados.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Não repita a si mesmo - Pesquisando emails com expressão regular | |
------------------------------------------------------------------- | |
-- Selecionando emails validos no banco de dados | |
SELECT eml_email | |
FROM tb_email | |
WHERE eml_email REGEXP ‘^[a-zA-Z0-9]{1}([\._a-zA-Z0-9-]+)(\.[_a-zA-Z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+){1,3}$’ | |
-- Selecionando emails não válidos no banco de dados | |
SELECT eml_email | |
FROM tb_email | |
WHERE eml_email NOT REGEXP ‘^[a-zA-Z0-9]{1}([\._a-zA-Z0-9-]+)(\.[_a-zA-Z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+){1,3}$’ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment