On Wed, Sep 07, 2005 at 11:17:10AM -0400, Brad Nicholson wrote: > Does anybody have regular expression handy to verfiy email addresses? It's not possible to validate an email address with a regex. If you're prepared to handwave over things like whitespace and embedded comments you can validate with a scary big regex. Take a look at Mail::RFC822::Address from CPAN. But, depending on what you're doing, validation may not be a good idea. There are email addresses that are syntactically invalid that are deliverable and in active use. You might want to look at just doing some basic sanity checking instead, rather than full validation - something like /^[^@]*@(?:[^@]*\.)?[a-z0-9-_]+\.(?:a[defgilmnoqrstuwz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvxyz]|d[ejkmoz]|e[ceghrst]|f[ijkmorx]|g[abdefhilmnpqrstuwy]|h[kmnrtu]|i[delnoqrst]|j[mop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrtwy]|qa|r[eouw]|s[abcdeghijklmnortvyz]|t[cdfghjkmnoprtvwz]|u[agkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw]|edu|com|net|org|gov|mil|info|biz|coop|museum|aero|name|pro)$/ This'll exclude email addresses like tv@tv, but the owners of such are used to their being rejected, and it saves you from a lot of the usual miskeyed addresses. Cheers, Steve ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster