Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email Validator in Form

Status
Not open for further replies.

oahu9872

Programmer
Aug 12, 2005
9
US
I would like to require valid email addresses in my form, making sure that there is the @ symbol somewhere in the field. Does anyone know the code to do this? Is it ASP or HTML?

Thanks
 
if your addresses are internal ones then you could also check Exchange to see if they are 'real'.
 
I would recommend using a regex with this pattern:

oRE.Pattern ="^[\w-\.]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,3}$"

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
This is what I used, and it works well.



Dim EmailAtCheck
Dim strEmail : strEmail = Request.QueryString("Email")
If InStr(strEmail, "@") Then
EmailAtCheck = "TRUE"
else
EmailAtCheck = "FALSE"
end if
 
What if someone enters

@somewhere

as their email address? Or simply enters @?

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top