Skip to content

Instantly share code, notes, and snippets.

@vmussak
Created August 5, 2018 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vmussak/a03d79a8b61b57ea36b83c2fd21a05e2 to your computer and use it in GitHub Desktop.
Save vmussak/a03d79a8b61b57ea36b83c2fd21a05e2 to your computer and use it in GitHub Desktop.
var listaDeEmails = new ListaDeEmails().Buscar();
var emailRegex = @"^(?!\.)(""([^""\r\\]|\\[""\r\\])*""|([-a-z0-9!#$%&'*+/=?^_`{|}~]|(?<!\.)\.)*)(?<!\.)@[a-z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$";
var regex = new Regex(emailRegex, RegexOptions.IgnoreCase);
foreach (var email in listaDeEmails)
{
var oEmailEstaValido = regex.IsMatch(email);
if (oEmailEstaValido)
{
//Alguma operacão aqui...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment