Check if variable value is a valid email.

S

Shapper

Hello,

I have an aspx.vb code with a function.
In this function I need to check if a variable is a valid email address.

Something like: (e-mail address removed)

How can I do this?

Thanks,
Miguel
 
S

Shapper

Hello,

I know the ASP.NET build in validation control to place in HTML code.

What I need is to check if variable myEmail has a valid email address.
I need to do this in my vb.net code in my aspx.vb code file.

Can someone send me an example of how to create this?

Thanks,
Miguel
 
Joined
Sep 20, 2006
Messages
1
Reaction score
0
You can use the following syntax

If System.Text.RegularExpressions.Regex.IsMatch("youemail", "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$") = True Then

if it is valid then it will return true
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top