[thelist] REGEX: Tip- A regex library

Kristof Neirynck k.neirynck at belgacom.net
Tue Jun 17 07:08:11 CDT 2003


Oren Levin wrote:
> Too bad all of the email regex examples fail RFC 822:
> 
> "Some Silly User"@example.com
> Another'User at example.com
> Yet/Another/Wacky/User at example.com


^(([^<>;;()[\]\\.,;:@"]+(\.[^<>()[\]\\.,;:@"]+)*)|(".+"))@((([a-z]([-a-z0-9]*[a-z0-9])?)|(#[0-9]+)|(\[((([01]?[0-9]{0,2})|(2(([0-4][0-9])|(5[0-5]))))\.){3}(([01]?[0-9]{0,2})|(2(([0-4][0-9])|(5[0-5]))))\]))\.)*(([a-z]([-a-z0-9]*[a-z0-9])?)|(#[0-9]+)|(\[((([01]?[0-9]{0,2})|(2(([0-4][0-9])|(5[0-5]))))\.){3}(([01]?[0-9]{0,2})|(2(([0-4][0-9])|(5[0-5]))))\]))$

This one matches those, but ist also matches
Some Silly User at example.com


Kristof



More information about the thelist mailing list