Page 1 of 1

Email Validation

Posted: Thu Jan 21, 2016 12:56 am
by smith8867
Is there anyway in LiveCode to validate an email that is entered into a field?

Thanks.

Re: Email Validation

Posted: Thu Jan 21, 2016 3:30 am
by Simon
Here, I found this function somewhere a long time ago;

Code: Select all

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[04]\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
Thank you to whoever wrote it :)

Simon