473,386 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Any email validation functions?

Does anyone have any VB.NET functions which validate an email address?
Could you post it? I would like it to do as much as the regular expression
validator if possible.

Thanks in advance!
Nov 18 '05 #1
8 1477
there should already be a email validator regex function in the validators
to test for this (at least there is in asp.net) but here you go...

\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

regex function to validate all email addresses

"VB Programmer" <Do*****************@jEmail.com> wrote in message
news:uu**************@TK2MSFTNGP09.phx.gbl...
Does anyone have any VB.NET functions which validate an email address?
Could you post it? I would like it to do as much as the regular
expression
validator if possible.

Thanks in advance!

Nov 18 '05 #2
Thanks, but I'm looking for a VB.NET version. Do you know of one?

"Brian Henry" <br**********@newsgroups.nospam> wrote in message
news:ex*************@TK2MSFTNGP11.phx.gbl...
there should already be a email validator regex function in the validators
to test for this (at least there is in asp.net) but here you go...

\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

regex function to validate all email addresses

"VB Programmer" <Do*****************@jEmail.com> wrote in message
news:uu**************@TK2MSFTNGP09.phx.gbl...
Does anyone have any VB.NET functions which validate an email address?
Could you post it? I would like it to do as much as the regular
expression
validator if possible.

Thanks in advance!


Nov 18 '05 #3
Oh... I got it! Here's one I'd like to share. If anyone has any better one
please let me know.

Private Function EmailIsValid(ByVal strEmailAddress As String) As
Boolean
Return Regex.IsMatch(strEmailAddress,
"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9
\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")
End Function

Thanks!
"VB Programmer" <Do*****************@jEmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Thanks, but I'm looking for a VB.NET version. Do you know of one?

"Brian Henry" <br**********@newsgroups.nospam> wrote in message
news:ex*************@TK2MSFTNGP11.phx.gbl...
there should already be a email validator regex function in the validators to test for this (at least there is in asp.net) but here you go...

\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

regex function to validate all email addresses

"VB Programmer" <Do*****************@jEmail.com> wrote in message
news:uu**************@TK2MSFTNGP09.phx.gbl...
Does anyone have any VB.NET functions which validate an email address?
Could you post it? I would like it to do as much as the regular
expression
validator if possible.

Thanks in advance!



Nov 18 '05 #4
Jos
VB Programmer wrote:
Oh... I got it! Here's one I'd like to share. If anyone has any
better one please let me know.

Private Function EmailIsValid(ByVal strEmailAddress As String) As
Boolean
Return Regex.IsMatch(strEmailAddress,
"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9 \-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")
End Function


Unfortunately, this code will refuse mails from the "museum" domain.

Replace the {2,4} with {2,6} to allow for this domain as well.

--

Jos
Nov 18 '05 #5
Thanks! Great catch!

"Jos" <jo***************@fastmail.fm> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
VB Programmer wrote:
Oh... I got it! Here's one I'd like to share. If anyone has any
better one please let me know.

Private Function EmailIsValid(ByVal strEmailAddress As String) As
Boolean
Return Regex.IsMatch(strEmailAddress,

"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9
\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")
End Function


Unfortunately, this code will refuse mails from the "museum" domain.

Replace the {2,4} with {2,6} to allow for this domain as well.

--

Jos

Nov 18 '05 #6
In addition to the other comments:

MSDN has a handful of common Regular Expressions
patterns.

Here is the e-mail example:
http://msdn.microsoft.com/library/de...mailformat.asp

The same section has a number of other examples.
I also find these pages to be useful when dealing with Regular Expressions:
http://www.regular-expressions.info/

http://msdn.microsoft.com/library/de...geElements.asp

Hope this helps
Jay

"VB Programmer" <Do*****************@jEmail.com> wrote in message
news:uu**************@TK2MSFTNGP09.phx.gbl...
Does anyone have any VB.NET functions which validate an email address?
Could you post it? I would like it to do as much as the regular
expression
validator if possible.

Thanks in advance!

Nov 18 '05 #7
I don't get anything of what is happening in the function!!! How does this
validate Email addresses and why not the museum domain??
Confused & (probably) stupid.

"VB Programmer" <Do*****************@jEmail.com> wrote in message
news:ev**************@TK2MSFTNGP11.phx.gbl...
Thanks! Great catch!

"Jos" <jo***************@fastmail.fm> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
VB Programmer wrote:
Oh... I got it! Here's one I'd like to share. If anyone has any
better one please let me know.

Private Function EmailIsValid(ByVal strEmailAddress As String) As
Boolean
Return Regex.IsMatch(strEmailAddress,

"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9
\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")
End Function


Unfortunately, this code will refuse mails from the "museum" domain.

Replace the {2,4} with {2,6} to allow for this domain as well.

--

Jos


Nov 18 '05 #8
Never mind, just saw Jay's post.
"Vince" <sd***@fsd.com> wrote in message
news:ul*************@tk2msftngp13.phx.gbl...
I don't get anything of what is happening in the function!!! How does this
validate Email addresses and why not the museum domain??
Confused & (probably) stupid.

"VB Programmer" <Do*****************@jEmail.com> wrote in message
news:ev**************@TK2MSFTNGP11.phx.gbl...
Thanks! Great catch!

"Jos" <jo***************@fastmail.fm> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
VB Programmer wrote:
> Oh... I got it! Here's one I'd like to share. If anyone has any
> better one please let me know.
>
> Private Function EmailIsValid(ByVal strEmailAddress As String) As > Boolean
> Return Regex.IsMatch(strEmailAddress,
>

"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9
> \-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")
> End Function

Unfortunately, this code will refuse mails from the "museum" domain.

Replace the {2,4} with {2,6} to allow for this domain as well.

--

Jos



Nov 18 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: Dynamo | last post by:
Hi The following script was taken from John Coggeshall's (PHP consultant) in his article on Zends site at http://www.zend.com/zend/spotlight/ev12apr.php // Get the email address to validate...
72
by: Stephen Poley | last post by:
I have quite often (as have probably many of you) come across HTML forms with irritating bits of Javascript attached. The last straw on this particular camel's back was a large form I was asked to...
18
by: Steve | last post by:
Hi I have a really weird problem and any assistance would be welcome. I have developed an app in Access 2002. The app runs perfectly on the development machine. I have packaged the app using...
2
by: TIBM | last post by:
Hi. I've posted this question on another newsgroup, but I haven't received any answers.. I have a login page where users input userID and password and click a Login button. Before calling the ...
8
by: VB Programmer | last post by:
Does anyone have any VB.NET functions which validate an email address? Could you post it? I would like it to do as much as the regular expression validator if possible. Thanks in advance!
11
by: Rik | last post by:
Hello guys, now that I'm that I'm working on my first major 'open' forms (with uncontrolled users I mean, not a secure backend-interface), I'd like to add a lot of possibilities to check wether...
7
by: e_matthes | last post by:
Hello everyone, I've read enough about email validation to know that the only real validation is having a user respond to a confirmation message you've sent them. However, I want to store the...
4
by: JvC | last post by:
Does anyone have a good routine for EMail address validation? The one that I use is fairly primitive, and I need to beef it up. I have downloaded several from the web, and they all get screwed up...
8
by: Bryan | last post by:
I want my business objects to be able to do this: class Person(base): def __init__(self): self.name = None @base.validator def validate_name(self): if not self.name: return
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.