Hello,
Do anyone know what's the code for email validation in a field??
Email Validation
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Email Validation
I use this:
Code: Select all
#we need to test tEmail
put "((?i)(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|§(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*§)@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\]))" into regemail
replace "§" with quote in regemail #now regemail is the correct regula espression
put matchtext(temail,regemail,controllo) into temp
if controllo is not temail then
answer temail " is not a valid email address"
end if
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Email Validation
Hello MaxV,
sorry i'm abit blur
My field name is call "emailfield".
My button script is to check the validation of the email ~
How should i put this code into my button script??
Thanks!
sorry i'm abit blur
My field name is call "emailfield".
My button script is to check the validation of the email ~
How should i put this code into my button script??
Thanks!
-
- VIP Livecode Opensource Backer
- Posts: 9579
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Email Validation
Hi.
Craig
This will throw an error. It should be:sorry i'm abit blur
Code: Select all
sorry i'm a bit ablur
Craig
Re: Email Validation
Hello, thanks all! I managed to get it ~ ~
Appreciate all your help
Appreciate all your help
Code: Select all
on mouseup
put fld "email" into temail
put "((?i)(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|§(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*§)@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\]))" into regemail
replace "§" with quote in regemail #now regemail is the correct regula espression
put matchtext(temail,regemail,validate) into temp
if validate is not temail then
answer " is not a valid email address"
else
answer "is email"
end if
end mouseup