Page 1 of 1

Update K. Ray email address verification? (regex)

Posted: Fri Dec 05, 2014 10:18 am
by Simon
Hello all,
I have Ken Ray's email verification code that I need adapted to accept "+" in the address.
Here is the original code:

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
I would like it to accept "simon+112@gmail.com" (err.. 112 is randomly generated).

Any regex hero's out there today?

Thanks,
Simon

Re: Update K. Ray email address verification? (regex)

Posted: Fri Dec 05, 2014 12:05 pm
by LCNeil
Hey Simon,

Im no regex hero and have never used any extreme regex before, but the following should allow email address with "+" to be accepted

Code: Select all

return matchText(what,"^[A-z0-9_\-\.\+]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]$")
This following is a pretty awesome site that should allow you to test any regex expressions on the fly :)

http://www.regexr.com/

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com

Re: Update K. Ray email address verification? (regex)

Posted: Fri Dec 05, 2014 12:20 pm
by Simon
Hi Neil,
Works great! Thanks.

Excellent regex resource http://www.regexr.com/ now I can "see" how it's working.

Simon
LiveCode Supported Team :)