diff --git a/core/src/main/resources/template/xhtml/form-close-validate.ftl b/core/src/main/resources/template/xhtml/form-close-validate.ftl index f129156e5..e8dd9915a 100644 --- a/core/src/main/resources/template/xhtml/form-close-validate.ftl +++ b/core/src/main/resources/template/xhtml/form-close-validate.ftl @@ -114,13 +114,13 @@ END SNIPPET: supported-validators <#if validator.shortCircuit>continueValidation = false; } <#elseif validator.validatorType = "email"> - if (continueValidation && fieldValue != null && fieldValue.length > 0 && fieldValue.match("${validator.regex?js_string}")==null) { + if (continueValidation && fieldValue != null && fieldValue.length > 0 && fieldValue.match(/${validator.regex}/i)==null) { addError(field, error); errors = true; <#if validator.shortCircuit>continueValidation = false; } <#elseif validator.validatorType = "url"> - if (continueValidation && fieldValue != null && fieldValue.length > 0 && fieldValue.match("/${validator.urlRegex?js_string}/i")==null) { + if (continueValidation && fieldValue != null && fieldValue.length > 0 && fieldValue.match(/${validator.urlRegex}/i)==null) { addError(field, error); errors = true; <#if validator.shortCircuit>continueValidation = false; diff --git a/core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java b/core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java index ca9a54990..d24d7955d 100644 --- a/core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/validator/EmailValidatorTest.java @@ -30,6 +30,7 @@ import com.opensymphony.xwork2.validator.validators.EmailValidator; public class EmailValidatorTest extends XWorkTestCase { public void testEmailValidity() throws Exception { + assertTrue(verifyEmailValidity("TmJee@Yahoo.com")); assertTrue(verifyEmailValidity("tmjee@yahoo.com")); assertTrue(verifyEmailValidityWithExpression("tmjee@yahoo.com", "\\b^[a-z]+@[a-z]+(\\.[a-z]+)*\\.com$\\b")); assertTrue(verifyEmailValidity("tm_jee@yahoo.co"));