[thelist] regex for email check
martin burns
martin at members.evolt.org
Wed Jan 3 08:45:08 CST 2001
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
At 07:03 01/01/01, Adrian Fischer wrote:
>I know but does anyone have a down and dirty check for things like "@" and
>"." in an email .
>Im assuming it would be something like this:
>
>death("You must enter a valid email addres") if (($form{'email'} ne "stuff
>in here?????.")
if ($form{'email'} =~ /(@.@)|(\.\.)|(@\.)|(\.@)|(^\.)(\.$)/
# does the email contain:
# @@
# ..
# .@
# . at the start or the end
|| # or
($form{'email'} !~ /^.+@(\w|[-.])+\.[a-zA-Z]{2,3}$))
# does the email *fail* to be formatted as:
# some stuff followed by an @
# then one or more alphanumerics, hyphens or dots
# then a dot, and two or 3 alphanumberics for the
# TLD
{
die "&form{'email'} just ain't right, y'all";
}
# it's not a valid email address.
________________
Martin Burns, Content Management Consultant
tel: +44 (0)774 063 9985
http://www.evolt.org/user/MartinB/32/evolt.org
http://www.easyweb.co.uk/
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com>
Comment: PGP Key ID: 0xA835CCCB
iQA/AwUBOlMsZXHoHnCoNczLEQJATQCgmVacY/o/MypfDoT0JfrsjbJpSwsAoIT+
WSsvMF0l6dV6s1xLUNKccQ8Z
=zeLw
-----END PGP SIGNATURE-----
More information about the thelist
mailing list