473,396 Members | 1,963 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,396 software developers and data experts.

checking the format of e-mail in a textbox

hi everyone, I have a textbox which contains the e-mail address of
user, but I have no Idea how to apply the regular expression in
VB.net, what would be the solution for the is e-mail given in text box
have proper format (e.g na****@domain.com), can anyone tell me the
solution for this, the reply would be appriciated.... thanx

Jan 28 '07 #1
5 4701
Google for "Email Regex", you will get tons of hits.

To really cover all cases of valid email addresses you need a very long
regex which is probably subject to change at any time in the future as more
extensions like "biz" etc are added.

I tried to make a more complete regex to validate an email address before
storing it in a database, but immediately ran into problems with odd
addresses like so*****@domain.gov.ky. I ended up going with the most simple
check for at least one letter before and "@" and ends with "." + two
letters. I figured that any invalid email address would be cought by the
SMTP server whenever it is used which is the "final authority" anyway and
will keep current with whatever is considered valid at the time.

HTH

Rick

"zafar" <za*******@hotmail.comwrote in message
news:11**********************@l53g2000cwa.googlegr oups.com...
hi everyone, I have a textbox which contains the e-mail address of
user, but I have no Idea how to apply the regular expression in
VB.net, what would be the solution for the is e-mail given in text box
have proper format (e.g na****@domain.com), can anyone tell me the
solution for this, the reply would be appriciated.... thanx

Jan 28 '07 #2
zafar <za*******@hotmail.comwrote in message
<11**********************@l53g2000cwa.googlegroups .com>:
>hi everyone, I have a textbox which contains the e-mail address of
user, but I have no Idea how to apply the regular expression in
VB.net, what would be the solution for the is e-mail given in text
box have proper format (e.g na****@domain.com), can anyone tell me
the solution for this, the reply would be appriciated.... thanx
In the simplest form:
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

should give you what you're looking for...

--
Brad Prendergast
"It has long since come to my attention that people of accomplishment
rarely sat back and let things happen to them. They went out and
happened to things." -- Leonardo da Vinci (1452 – 1519)
Jan 28 '07 #3
Brad, or any one else
Thank you for posting in the news groups
I'm very new to programing in fact I have only copied the "helo world" stuff
from a book into the IDE thus far.
However I'm following the news groups to learn from other peoples questions

Your solution looks like the same expression three times one before the @
sign one after the @ sign and one after the (DOT sign) except for the extra
+ sign in the first one? "\w+([-+.]\w+)*" can you tell me the meaning of
this? I think "*" is a wild card (at least it was in my DOS days)

Thank you in advance from a true newbe,

Randy

"Brad Prendergast" <format('bradp%sbpsoftware.com',['@'])wrote in message
news:xn***************@msnews.microsoft.com...
zafar <za*******@hotmail.comwrote in message
<11**********************@l53g2000cwa.googlegroups .com>:
>>hi everyone, I have a textbox which contains the e-mail address of
user, but I have no Idea how to apply the regular expression in
VB.net, what would be the solution for the is e-mail given in text
box have proper format (e.g na****@domain.com), can anyone tell me
the solution for this, the reply would be appriciated.... thanx

In the simplest form:
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

should give you what you're looking for...

--
Brad Prendergast
"It has long since come to my attention that people of accomplishment
rarely sat back and let things happen to them. They went out and
happened to things." -- Leonardo da Vinci (1452 - 1519)

Jan 28 '07 #4
Randy <ac***@comcast.netwrote in message
<Dp******************************@comcast.com>:
>Brad, or any one else
Thank you for posting in the news groups
I'm very new to programing in fact I have only copied the "helo
world" stuff from a book into the IDE thus far.
However I'm following the news groups to learn from other peoples
questions

Your solution looks like the same expression three times one before
the @ sign one after the @ sign and one after the (DOT sign) except
for the extra + sign in the first one? "\w+([-+.]\w+)*" can you tell
me the meaning of this? I think "*" is a wild card (at least it was
in my DOS days)

Thank you in advance from a true newbe,

Randy

"Brad Prendergast" <format('bradp%sbpsoftware.com',['@'])wrote in
message news:xn***************@msnews.microsoft.com...
>>zafar <za*******@hotmail.comwrote in message
<11**********************@l53g2000cwa.googlegrou ps.com>:
>>>hi everyone, I have a textbox which contains the e-mail address of
user, but I have no Idea how to apply the regular expression in
VB.net, what would be the solution for the is e-mail given in text
box have proper format (e.g na****@domain.com), can anyone tell me
the solution for this, the reply would be appriciated.... thanx

In the simplest form:
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

should give you what you're looking for...

-- Brad Prendergast
"It has long since come to my attention that people of
accomplishment rarely sat back and let things happen to them. They
went out and happened to things." -- Leonardo da Vinci (1452 -
1519)
Take a look at http://msdn2.microsoft.com/en-us/library/az24scfc.aspx
if you jump to the links it might make it a bit easier for you to
understand. What I ended up doing at one point was putting a 'cheat
sheet' together from the pages.

--
Brad Prendergast
"Anyone who has never made a mistake has never tried anything new." --
Albert Einstein (1879 - 1955)
Jan 28 '07 #5
On Jan 28, 8:19 pm, "Brad Prendergast" <format('bradp%sbpsoftware.com',
['@'])wrote:
zafar <zafarz...@hotmail.comwrote in message

<1169995739.086038.254...@l53g2000cwa.googlegroups .com>:
hi everyone, I have a textbox which contains the e-mail address of
user, but I have no Idea how to apply the regular expression in
VB.net, what would be the solution for the is e-mail given in text
box have proper format (e.g nam...@domain.com), can anyone tell me
the solution for this, the reply would be appriciated.... thanx

In the simplest form:
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

should give you what you're looking for...

--
Brad Prendergast
"It has long since come to my attention that people of accomplishment
rarely sat back and let things happen to them. They went out and
happened to things." -- Leonardo da Vinci (1452 - 1519)

thanx for guiding me..... but would you plz tell me how can I apply
this regular expression in my VB.Net because I have no Idea about
this.... let ii have a from having a textbox in it,,,, user types an e-
mail address in it, and before adding that text to database I want to
check whether the given text follow the e-mail format or not....
i required a code for apply these regular expression to my form... plz
can you guide me for this,,, I will be really thankfull to you.

Feb 2 '07 #6

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

Similar topics

7
by: - ions | last post by:
I have created a JComboBox with its Items as a list of "M" numbers ie. M1,M2,M3.......throgh too M110 (thes are the messier objects, a catolouge of deep sky objects) the user selects of of these...
2
by: Astra | last post by:
Hi Guys Can anybody advise me on how to check for a 'no later than today's date' value from 3 <SELECT> fields. I have 3 <SELECT> fields, which are one for the day, one for the month and one...
28
by: romy | last post by:
What's the easiest way to verify the user had entered a valid date ?
7
by: Hulo | last post by:
In a C program I am required to enter three numbers (integers) e.g. 256 7 5 on execution of the program. C:\> 256 7 5 There should be spaces between the three numbers and on pressing "enter",...
4
by: Patient Guy | last post by:
Does anyone have any coding rules they follow when doing argument checking? When arguments fail during check, do you return from the call with an ambiguous return value, or do you throw...
8
by: J-P-W | last post by:
Hi, anyone got any thoughts on this problem? I have sales reps. that remotely send their data to an ftp server. The office downloads all files, the code creates an empty file, then downloads the...
1
by: powerej | last post by:
program is suppose to ask for an input from 1-8, if the user enters a number outside of this range than it will continue to ask until it does, something is wrong and i cant seem to figure it out, i...
0
by: elias.farah | last post by:
Hello Everyone, I've been searching for a few hours on how to check the available disk space (on a Flash disk actually) from within MS-Access. Basically, I want to ensure there is adequate...
1
by: davebaty | last post by:
I have a text box in vb2005 where text needs to be entered in a certain format eg. a time hh:mm or another with just four characters. I want the backcolor of the box to change color if the format is...
6
by: Mike P | last post by:
How do I check for a valid datetime, where both the date and the time must be entered in the format DD/MM/YYYY HH:MM? Using Convert.ToDateTime would work even if a time is not added so I can't...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.