shaungyuehuoniao / gwt-ext

Automatically exported from code.google.com/p/gwt-ext
0 stars 2 forks source link

Validating multiple email addresses in GWT-ext #525

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi All,
I want to validate multiple email addresses in GWT. 
I used VType.Email but it validates a single email address only and does
not accept comma or any other seperator.

I searched for regex for multiple email addresses and i found:

[code]
\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*([,;]\\s*\\w+([-+.]\\w+)*@\\w+
([-.]\\w+)*\\.\\w+([-.]\\w+)*)*
  [/code]

but it validates the first email address entered, and after comma it
accepts anything entered.

Can any one help to validate multiple email addresses in GWT as i used
Pattern class of java but it is not supported in gwt, it does not allow my
application to run. 

i want to validate multiple email addresses entered using seperator.

Original issue reported on code.google.com by purohitp...@gmail.com on 7 Jun 2010 at 9:05

GoogleCodeExporter commented 8 years ago
hey all,

I got the answer, the below regular expression works for validating multiple 
email
addresses seperated by comma:

[code] 
^(\s*,?\s*[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-z
A-Z]{2,9})+\s*$
 [/code]

Original comment by purohitp...@gmail.com on 7 Jun 2010 at 11:01

GoogleCodeExporter commented 8 years ago
Hello Punam,

I tried to use your code and it doesn't work. I think \s is not a valid java 
escape character. could you please let me know how this work? or if u have 
sample code, that would be great

Original comment by hakkindu...@gmail.com on 4 Oct 2013 at 9:56