URL and email regex

Jesse Sng jsng at wayoflife.org
Tue Sep 28 15:39:05 EDT 2004


>Jesse, here's one for an email address (*really* watch for line breaks - I
>put in hard returns and indents so it formats properly and is legible, but
>you'll have to take them out):
>
>function isEmail pWhat
>   put matchText(pWhat,"^[A-z0-9_\-\.]+[@][A-z0-9_\-]+
>      ([.][A-z0-9_\-]+)+[A-z]$") into tNotIP
>   put matchText(pWhat,"^(\d{1,3})\.(\d{1,3})\.(\d{1,3})
>       \.(\d{1,3})$") into tIsIP
>   return (tIsIP or tNotIP)
>   -- supports:
>   --   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
>end isEmail

Thanks Ken!


Jesse


More information about the use-livecode mailing list