Valdating Email Address

Got a problem you cannot solve? Try here.
Post Reply
swarovski
Posts: 109
Joined: Mon Apr 16, 2007 8:32 pm

Valdating Email Address

Post by swarovski »

I have put a Email Address textbox in the Registration Information screen for my setup project.

How do I validate it?
Simple rules like [email protected] is enough.

must have @ and .

Thank you!
Fig
Posts: 22
Joined: Tue Aug 15, 2006 12:27 pm

Post by Fig »

This is a bit simplistic (doesn't check for invalid characters) but try:

Set Variable EMAILFAIL to TRUE
Set Variable EMAILNAME to
Set Variable EMAILDOMAIN to
Comment: Check for invalid space character (pattern in next statement is a space)
Parse String $EMAIL$ into Variables EMAILNAME and EMAILDOMAIN (Split at first occurrence of pattern)
if Variable EMAILDOMAIN Equals
Comment: Check for strings on each side of the asterisk (pattern in next Parse String is an asterisk)
Parse String $EMAIL$ into Variables EMAILNAME and EMAILDOMAIN (Split at first occurrence of pattern)
if Variable EMAILNAME not Equals
if Variable EMAILDOMAIN not Equals
Comment: Check for a period in the domain (pattern in next Parse String is a period)
Set Variable EMAILDOMAIN_1 to
Set Variable EMAILDOMAIN_2 to
Parse String $EMAILDOMAIN$ into Variables EMAILDOMAIN_1 and EMAILDOMAIN_2 (Split at last occurrence of pattern)
if Variable EMAILDOMAIN_1 not Equals
if Variable EMAILDOMAIN_2 not Equals
Set Variable EMAILFAIL to FALSE
end
end
end
end
end
if Variable EMAILFAIL Equals True
Comment: Take action on the invalid e-mail address
end


Where $EMAIL$ is the variable containing the email address to test.
... Fig
swarovski
Posts: 109
Joined: Mon Apr 16, 2007 8:32 pm

Post by swarovski »

Thanks a lot Fig. It really helps!

btw, the pattern in the 2nd parse should be: "@"

Fig wrote:This is a bit simplistic (doesn't check for invalid characters) but try:

Set Variable EMAILFAIL to TRUE
Set Variable EMAILNAME to
Set Variable EMAILDOMAIN to
Comment: Check for invalid space character (pattern in next statement is a space)
Parse String $EMAIL$ into Variables EMAILNAME and EMAILDOMAIN (Split at first occurrence of pattern)
if Variable EMAILDOMAIN Equals
Comment: Check for strings on each side of the asterisk (pattern in next Parse String is an asterisk)
Parse String $EMAIL$ into Variables EMAILNAME and EMAILDOMAIN (Split at first occurrence of pattern)
if Variable EMAILNAME not Equals
if Variable EMAILDOMAIN not Equals
Comment: Check for a period in the domain (pattern in next Parse String is a period)
Set Variable EMAILDOMAIN_1 to
Set Variable EMAILDOMAIN_2 to
Parse String $EMAILDOMAIN$ into Variables EMAILDOMAIN_1 and EMAILDOMAIN_2 (Split at last occurrence of pattern)
if Variable EMAILDOMAIN_1 not Equals
if Variable EMAILDOMAIN_2 not Equals
Set Variable EMAILFAIL to FALSE
end
end
end
end
end
if Variable EMAILFAIL Equals True
Comment: Take action on the invalid e-mail address
end


Where $EMAIL$ is the variable containing the email address to test.
Post Reply