You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ja...@apache.org on 2007/07/13 15:48:43 UTC

svn commit: r555998 - /lenya/trunk/src/java/org/apache/lenya/ac/ItemUtil.java

Author: jann
Date: Fri Jul 13 06:48:42 2007
New Revision: 555998

URL: http://svn.apache.org/viewvc?view=rev&rev=555998
Log:
Adding new method to validate for a correct email adress

Modified:
    lenya/trunk/src/java/org/apache/lenya/ac/ItemUtil.java

Modified: lenya/trunk/src/java/org/apache/lenya/ac/ItemUtil.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/ac/ItemUtil.java?view=diff&rev=555998&r1=555997&r2=555998
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/ItemUtil.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/ItemUtil.java Fri Jul 13 06:48:42 2007
@@ -30,5 +30,15 @@
     public static boolean isValidId(String id) {
         return id != null && id.matches("\\w+");
     }
+    
+    /**
+     * Check if a string is a valid email using the following regex
+     * <code>(\\w+\\.)*(\\w+)@(\\w+\\.)(\\w+)(\\.\\w+)*</code>
+     * @param email
+     * @return
+     */
+    public static boolean isValidEmail(String email) {
+    	return email != null && email.matches("(\\w+\\.)*(\\w+)@(\\w+\\.)(\\w+)(\\.\\w+)*");
+    }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org