OT Email Well-Formed Checkers

Ken Ray kray at sonsothunder.com
Sun Nov 19 21:55:03 EST 2006


On 11/19/06 1:38 PM, "Sivakatirswami" <katir at hindu.org> wrote:

> So: to everyone and anyone: can you post your well-formed email check
> functions that
>   you use in your CGI's  here? I have one, but it's like 8 years old.
> 
> Ken, "Master of RegEx"  you must have something, n'est ce pas?

Mais, bien sûr! ;-)

Here it is (watch for line wraps):

function isEmail pWhat
  put 
matchText(pWhat,"^[A-z0-9_\-\.]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]$")
into tNotIP
  put 
matchText(pWhat,"^(1*\d{1,2}|2[0-4]\d|25[0-5])\.(1*\d{1,2}|2[0-4]\d|25[0-5])
\.(1*\d{1,2}|2[0-4]\d|25[0-5])\.(1*\d{1,2}|2[0-4]\d|25[0-5])(:\d{1,5})*$")
into tIsIP
  return (tIsIP or tNotIP)
end isEmail

This supposedly covers:

  --   periods in user address (ken.ray at test.com)
  --   multiple subdomains (kenray at test.co.uk)
  --   new domains with more than 2 characters (.info, .museum, etc.)
  --   IP addresses (with or without port numbers)

Have fun!

Ken Ray
Sons of Thunder Software, Inc.
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com





More information about the use-livecode mailing list