Aldeia RPG

Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Suporte ao desenvolvimento de jogos


2 participantes

    Validação de e-mail com expressão regular que funciona 99,99%

    Valentine
    Valentine
    Administrador
    Administrador


    Medalhas : Validação de e-mail com expressão regular que funciona 99,99% ZgLkiRU
    Mensagens : 5345
    Créditos : 1164

    Validação de e-mail com expressão regular que funciona 99,99% Empty Validação de e-mail com expressão regular que funciona 99,99%

    Mensagem por Valentine Sáb maio 27, 2017 10:09 am

    Basta copiar e colar o regex e-mail abaixo para o idioma de sua escolha. Observe que não há nenhum regex e-mail perfeito, daí os 99,99%.

    Regex E-mail Geral (RFC 5322 Padrão oficial)
    Código:
    (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

    Python
    Código:
    r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)"

    Javascript
    Código:
    /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/

    HTML5
    Código:
    <input type="email" placeholder="Enter your email" />
    No caso de você se perguntar, abaixo está o regex usado em type = "email" do W3C:
    Código:
    /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/

    Swift (Somente Regex)
    Código:
    [A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}

    Swift (Regex usado em uma função)
    Código:
    let emailRegex = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
     return NSPredicate(format: "SELF MATCHES %@", emailRegex).evaluateWithObject(candidate)
    }

    PHP
    Código:
    /^(?!(?:(?:\x22?\x5C[\x00-\x7E]\x22?)|(?:\x22?[^\x5C\x22]\x22?)){255,})(?!(?:(?:\x22?\x5C[\x00-\x7E]\x22?)|(?:\x22?[^\x5C\x22]\x22?)){65,}@)(?:(?:[\x21\x23-\x27\x2A\x2B\x2D\x2F-\x39\x3D\x3F\x5E-\x7E]+)|(?:\x22(?:[\x01-\x08\x0B\x0C\x0E-\x1F\x21\x23-\x5B\x5D-\x7F]|(?:\x5C[\x00-\x7F]))*\x22))(?:\.(?:(?:[\x21\x23-\x27\x2A\x2B\x2D\x2F-\x39\x3D\x3F\x5E-\x7E]+)|(?:\x22(?:[\x01-\x08\x0B\x0C\x0E-\x1F\x21\x23-\x5B\x5D-\x7F]|(?:\x5C[\x00-\x7F]))*\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-[a-z0-9]+)*\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-[a-z0-9]+)*)|(?:\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\]))$/iD

    Perl / Ruby
    Código:
    (?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
     )+|\Z|(?=[\["()<>@,;:".\[\]]))|"(?:[^"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
     \r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(
     ?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|"(?:[^"\r\\]|\\.|(?:(?:\r\n)?[
     \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:".\[\] \000-\0
     31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|\[([^\[\]\r\\]|\\.)*\
     ](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:".\[\] \000-\031]+
     (?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:
     (?:\r\n)?[ \t])*))*|(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
     |(?=[\["()<>@,;:".\[\]]))|"(?:[^"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)
     ?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\
     r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
     \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)
     ?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t]
     )*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[
     \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*
     )(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
     )+|\Z|(?=[\["()<>@,;:".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)
     *:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+
     |\Z|(?=[\["()<>@,;:".\[\]]))|"(?:[^"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r
     \n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:
     \r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|"(?:[^"\r\\]|\\.|(?:(?:\r\n)?[ \t
     ]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:".\[\] \000-\031
     ]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|\[([^\[\]\r\\]|\\.)*\](
     ?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:".\[\] \000-\031]+(?
     :(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?
     :\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)|(?:[^()<>@,;:".\[\] \000-\031]+(?:(?
     :(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|"(?:[^"\r\\]|\\.|(?:(?:\r\n)?
     [ \t]))*"(?:(?:\r\n)?[ \t])*)*:(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:".\[\]
     \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|"(?:[^"\r\\]|
     \\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>
     @,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|"
     (?:[^"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t]
     )*(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
     ".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?
     :[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[
     \]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:".\[\] \000-
     \031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|"(?:[^"\r\\]|\\.|(
     ?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;
     :".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|\[([
     ^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:"
     .\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|\[([^\[\
     ]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:".\
     [\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|\[([^\[\]\
     r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:".\[\]
     \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|\[([^\[\]\r\\]
     |\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:".\[\] \0
     00-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|"(?:[^"\r\\]|\\
     .|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,
     ;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]]))|"(?
     :[^"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*
     (?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".
     \[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[
     ^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\]
     ]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)(?:,\s*(
     ?:(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
     ".\[\]]))|"(?:[^"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(
     ?:\r\n)?[ \t])*(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[
     \["()<>@,;:".\[\]]))|"(?:[^"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t
     ])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t
     ])+|\Z|(?=[\["()<>@,;:".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?
     :\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|
     \Z|(?=[\["()<>@,;:".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:
     [^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".\[\
     ]]))|"(?:[^"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)
     ?[ \t])*(?:@(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["
     ()<>@,;:".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)
     ?[ \t])*(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>
     @,;:".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[
     \t])*(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,
     ;:".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t]
     )*(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
     ".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?
     (?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:".
     \[\]]))|"(?:[^"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:
     \r\n)?[ \t])*(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\[
     "()<>@,;:".\[\]]))|"(?:[^"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])
     *))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])
     +|\Z|(?=[\["()<>@,;:".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\
     .(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
     |(?=[\["()<>@,;:".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(
     ?:\r\n)?[ \t])*))*)?;\s*)

    Perl 5.10 ou mais recente
    Código:
    /(?(DEFINE)(?<address>(?&mailbox) | (?&group)) (? (?&name_addr) | (?&addr_spec)) (? (?&display_name)? (?&angle_addr)) (? (?&CFWS)? < (?&addr_spec) > (?&CFWS)?) (? (?&display_name) : (?:(?&mailbox_list) | (?&CFWS))? ; (?&CFWS)?) (? (?&phrase)) (? (?&mailbox) (?: , (?&mailbox))*) (? (?&local_part) \@ (?&domain)) (? (?&dot_atom) | (?&quoted_string)) (? (?&dot_atom) | (?&domain_literal)) (? (?&CFWS)? \[ (?: (?&FWS)? (?&dcontent))* (?&FWS)? \] (?&CFWS)?) (? (?&dtext) | (?&quoted_pair)) (? (?&NO_WS_CTL) | [\x21-\x5a\x5e-\x7e]) (? (?&ALPHA) | (?&DIGIT) | [!#\$%&'*+-/=?^_`{|}~]) (? (?&CFWS)? (?&atext)+ (?&CFWS)?) (? (?&CFWS)? (?&dot_atom_text) (?&CFWS)?) (? (?&atext)+ (?: \. (?&atext)+)*) (? [\x01-\x09\x0b\x0c\x0e-\x7f]) (? \\ (?&text)) (? (?&NO_WS_CTL) | [\x21\x23-\x5b\x5d-\x7e]) (? (?&qtext) | (?&quoted_pair)) (? (?&CFWS)? (?&DQUOTE) (?:(?&FWS)? (?&qcontent))* (?&FWS)? (?&DQUOTE) (?&CFWS)?) (? (?&atom) | (?&quoted_string)) (? (?&word)+) # Folding white space (? (?: (?&WSP)* (?&CRLF))? (?&WSP)+) (? (?&NO_WS_CTL) | [\x21-\x27\x2a-\x5b\x5d-\x7e]) (? (?&ctext) | (?&quoted_pair) | (?&comment)) (? \( (?: (?&FWS)? (?&ccontent))* (?&FWS)? \) ) (? (?: (?&FWS)? (?&comment))* (?: (?:(?&FWS)? (?&comment)) | (?&FWS))) # No whitespace control (? [\x01-\x08\x0b\x0c\x0e-\x1f\x7f]) (? [A-Za-z]) (? [0-9]) (? \x0d \x0a) (? ") (? [\x20\x09]) ) (?&address)/x</address>

    Java
    Código:
    (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

    Ruby (versão simples)
    Código:
    /\A([\w+\-].?)+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i

    .NET (correspondência padrão geral)
    Código:
    ^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$

    C#
    Código:
    ^(?(")(".+?(?<!\\)"@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9][\-a-z0-9]{0,22}[a-z0-9]))$
    Outra maneira é usar a classe System.Net.Mail.MailAddress. Para determinar se um endereço de e-mail é válido, passe o endereço de e-mail para o construtor de classe MailAddress.MailAddress(String).

    VB.NET
    Código:
    Function isEmail(ByVal email as string) as boolean
        Static emailRegex As New Regex("^[_a-z0-9-]+(.[a-z0-9-]+)@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,4})$")

        return emailRegex.IsMatch(email)
    End Function

    Localizar todos os endereços de email em um arquivo usando Grep
    Código:
    $ grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" filename.txt

    Validação de e-mail do SQL Server
    Código:
    select email
     from table_name where
     patindex ('%[ &'',":;!+=\/()<>]%', email) > 0 -- Invalid characters
     or patindex ('[@.-_]%', email) > 0 -- Valid but cannot be starting character
     or patindex ('%[@.-_]', email) > 0 -- Valid but cannot be ending character
     or email not like '%@%.%' -- Must contain at least one @ and one .
     or email like '%..%' -- Cannot have two periods in a row
     or email like '%@%@%' -- Cannot have two @ anywhere
     or email like '%.@%' or email like '%@.%' -- Cannot have @ and . next to each other
     or email like '%.cm' or email like '%.co' -- Camaroon or Colombia? Typos.
     or email like '%.or' or email like '%.ne' -- Missing last letter

    Oracle PL/SQL Email Regex
    Código:
    SELECT email
    FROM table_name
    WHERE REGEXP_LIKE (email, '[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}');

    MySQL
    Código:
    SELECT * FROM `users` WHERE `email` NOT REGEXP '^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$';

    Autor: emailregex

    Ioriyagami190 gosta desta mensagem

    NighTxShadoW
    NighTxShadoW
    Ocasional
    Ocasional


    Mensagens : 222
    Créditos : 6

    Validação de e-mail com expressão regular que funciona 99,99% Empty Re: Validação de e-mail com expressão regular que funciona 99,99%

    Mensagem por NighTxShadoW Sáb maio 27, 2017 10:22 am

    GooD


    _________________
    Validação de e-mail com expressão regular que funciona 99,99% SSJ2-Gohan-Gif-rileyferguson-34521952-853-480

      Data/hora atual: Qui Nov 21, 2024 8:52 am