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

Email validation using regular expression

Hi ,
I have to validate multiple email ids in textbox seperated by ',' .Can any one help me in writing validation expression for this.
TextBox contains emailid as
asb9@tv.com,cd.g9@hg.cf.vom
Thanks
Dec 17 '07 #1
4 1446
dip_developer
648 Expert 512MB
Hi ,
I have to validate multiple email ids in textbox seperated by ',' .Can any one help me in writing validation expression for this.
TextBox contains emailid as
asb9@tv.com,cd.g9@hg.cf.vom
Thanks
split the Textbox text ....with TextBox1.Text.Split(",")...this will give you an array of strings....each array element will be an e-mail id......now validate those e-mail id with a regular expression.......there are plenty of examples in internet about "regular expression for e-mail validation"

I dont know whether this is the answer for you or not...
Dec 17 '07 #2
split the Textbox text ....with TextBox1.Text.Split(",")...this will give you an array of strings....each array element will be an e-mail id......now validate those e-mail id with a regular expression.......there are plenty of examples in internet about "regular expression for e-mail validation"

I dont know whether this is the answer for you or not...
I need to validate it in client side(not is server side)
Dec 18 '07 #3
Murdz
34
something like:

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. <script type="text/javascript">
  4.  
  5. function Validate()
  6. {
  7.     var addresses = document.getElementById("txtEmails").value.split(',');
  8.  
  9.     var re = new RegExp("^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$");
  10.  
  11.     for (int i=0; i<addresses.length; i++)
  12.     {
  13.         if (addresses[i].match(re))
  14.             continue;
  15.  
  16.         alert("Invalid email supplied: " + addresses[i]);
  17.  
  18.         return false;
  19.     }
  20.  
  21.     return true;
  22. }
  23.  
  24. </script>
  25.  
  26.  
Dec 18 '07 #4
something like:

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. <script type="text/javascript">
  4.  
  5. function Validate()
  6. {
  7.     var addresses = document.getElementById("txtEmails").value.split(',');
  8.  
  9.     var re = new RegExp("^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$");
  10.  
  11.     for (int i=0; i<addresses.length; i++)
  12.     {
  13.         if (addresses[i].match(re))
  14.             continue;
  15.  
  16.         alert("Invalid email supplied: " + addresses[i]);
  17.  
  18.         return false;
  19.     }
  20.  
  21.     return true;
  22. }
  23.  
  24. </script>
  25.  
  26.  
Thanks for the reply.
It didn't work properly.
I used this validate expression
"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)(\,([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)){0,}"
it's working fine
Jan 29 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Geoff Soper | last post by:
I've been looking for a simple way of checking that a string is an e-mail address. I don't need to check if the address exists, just if the format of the string matches. There seem to be lots of...
4
by: VbUser25 | last post by:
Hi Please suggest i think i am doing something wrong. I am calling fucntion test from another function where i am performing all the validations.I want to validate the email id. this is the...
3
by: Mark | last post by:
To validate the length of a multiline textbox, I'm told that I have to use a regular expression validator. The regular expression below limits it to 25 characters in length, but if the user enters...
2
by: Nazir | last post by:
Hi I'm using a regular expression validator, but if spaces are entered, it bypasses the validation! I'm using ^{5,100}$
5
by: Ryan | last post by:
HELLO I am using the following MICROSOFT SUGGESTED (somewhere on msdn) regular expression to validate email addresses however I understand that the RFP allows for "+" symbols in the email address...
35
by: Mika M | last post by:
Simple question: Does Framework (1.1) contain any routine to check entered email-address is valid ? It's quite easy to make own code for that purpose, but why to do if Framework (1.1) contain...
1
by: Jim Dornbush | last post by:
Has anyone seen an updated regex expression from Microsoft for the email validation expression so that single quotes are allowed? I've been using the canned regex for emails, but recently been...
10
by: ll | last post by:
Hi, I currently am using the following regex in js for email validation, in which the email addresses can be separated by commas or semicolons. The problem, however, lies in that I can type two...
2
by: jack | last post by:
Im a new bee in validation Im just in the design phase of the project and not thinking about having a saperate validaion block. Just browsed through validaion block of enterprise library which...
1
by: neoupadhyay | last post by:
Why my regular expression validation is not working Friends I am using asp.net 1.1 and i try to apply regular expression validation. when i run it at my local host its work cool, but when i upload...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.