commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bspeak...@apache.org
Subject svn commit: r588367 - /commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java
Date Thu, 25 Oct 2007 21:44:34 GMT
Author: bspeakmon
Date: Thu Oct 25 14:44:34 2007
New Revision: 588367

URL: http://svn.apache.org/viewvc?rev=588367&view=rev
Log:
- VALIDATOR-191: incrementally replace oro with java.util.regex

Modified:
    commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java

Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java?rev=588367&r1=588366&r2=588367&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java
(original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java
Thu Oct 25 14:44:34 2007
@@ -50,7 +50,7 @@
 
     // Each pattern must be surrounded by /
     private static final String LEGAL_ASCII_PATTERN = "^[\\0000-\\0177]+$";
-    private static final String EMAIL_PATTERN = "/^(.+)@(.+)$/";
+    private static final String EMAIL_PATTERN = "^(.+)@(.+)$";
     private static final String IP_DOMAIN_PATTERN = "^\\[(.*)\\]$";
     private static final String TLD_PATTERN = "/^([a-zA-Z]+)$/";
 
@@ -99,8 +99,9 @@
         email = stripComments(email);
 
         // Check the whole email address structure
-        Perl5Util emailMatcher = new Perl5Util();
-        if (!emailMatcher.match(EMAIL_PATTERN, email)) {
+        Pattern emailPattern = Pattern.compile(EMAIL_PATTERN);
+        Matcher emailMatcher = emailPattern.matcher(email);
+        if (!emailMatcher.matches()) {
             return false;
         }
 



Mime
View raw message