NYCPHP Meetup

NYPHP.org

[ot] RE: [nycphp-talk] Validating Email Addresses

Chris Bielanski Cbielanski at inta.org
Thu Dec 2 11:28:29 EST 2004


That looks like a PGP key written in RE!! @_@;;


Thanks,
Chris Bielanski
Web Programmer, 
International Trademark Association,
1133 Avenue of the Americas, 33rd Floor
New York, NY 10036
+1 (212) 642-1745, f: +1 (212) 768-7796
mailto:cbielanski at inta.org, www.inta.org  
INTA -- 125 Years of Excellence



> -----Original Message-----
> From: James B. Wetterau Jr. [mailto:james at surgam.net]
> Sent: Thursday, December 02, 2004 11:19 AM
> To: NYPHP Talk
> Subject: Re: [nycphp-talk] Validating Email Addresses 
> 
> 
> Dan Cech says:
>  > Hi All,
>  >
>  > I've come up against an interesting little problem, and wondered if
>  > anyone had any input for me.
> ...
> 
> To validate any potentially valid email address (including those that
> use old fashion conventions, multiple subnet parts
> (e.g. joe.smith at retail.sales.east.us.example.com), or other stuff that
> you don't see frequently requires a pretty daunting regular
> expression.  Here's one in Perl regexp language that's supposed to be
> RFC compliant: (from the Mail::RFC822::Address module)
> 
> http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html
> 
> The regexp is:
> 
> (?:(?:\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)?[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\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|(?=[\["()<>@,;:\\".\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))*@(?:(?:\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*)
> 
> 
> _______________________________________________
> New York PHP Talk
> Supporting AMP Technology (Apache/MySQL/PHP)
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.newyorkphp.org
> 



More information about the talk mailing list