Commits

musachy  committed 0d45d87

WW-2805 Allow single quotes in emails

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@1885e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits c056b0e

Comments (0)

Files changed (2)

File src/java/com/opensymphony/xwork2/validator/validators/EmailValidator.java

 
 	// see XW-371 
     public static final String emailAddressPattern =
-    	"\\b(^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@([A-Za-z0-9-])+(\\.[A-Za-z0-9-]+)*((\\.[A-Za-z0-9]{2,})|(\\.[A-Za-z0-9]{2,}\\.[A-Za-z0-9]{2,}))$)\\b";
+    	"\\b(^['_A-Za-z0-9-]+(\\.['_A-Za-z0-9-]+)*@([A-Za-z0-9-])+(\\.[A-Za-z0-9-]+)*((\\.[A-Za-z0-9]{2,})|(\\.[A-Za-z0-9]{2,}\\.[A-Za-z0-9]{2,}))$)\\b";
 
     public EmailValidator() {
         setExpression(emailAddressPattern);

File src/test/com/opensymphony/xwork2/validator/EmailValidatorTest.java

 		assertTrue(verifyEmailValidity("tm_jee@yahoo.com"));
 		assertTrue(verifyEmailValidity("tm_jee@yahoo.net"));
 		assertTrue(verifyEmailValidity(" user@subname1.subname2.subname3.domainname.co.uk "));
+        assertTrue(verifyEmailValidity("tm.j'ee@yahoo.co.uk"));
+        assertTrue(verifyEmailValidity("tm.j'e.e'@yahoo.co.uk"));
+        assertTrue(verifyEmailValidity("tmj'ee@yahoo.com"));
 		
 		assertFalse(verifyEmailValidity("tm_jee#marry@yahoo.co.uk"));
 		assertFalse(verifyEmailValidity("tm_jee@ yahoo.co.uk"));