1 13 19 package org.jahia.utils; 20 21 import org.apache.regexp.RE; 22 import org.apache.regexp.RESyntaxException; 23 24 25 26 31 32 33 public class DataValidator 34 { 35 36 private static RE emailRE; 37 38 static { 39 try { 40 emailRE = new RE("^[\\w\\-\\._=\\!#\\*\\+]+@((([\\w\\-]+\\.)+[a-zA-Z]{2,3})|localhost)$"); 41 } catch (RESyntaxException e) { 42 String errorMsg = "RE exception : " + e.getMessage(); 43 JahiaConsole.println( "DataValidator", errorMsg ); 44 } 45 } 46 47 53 public static boolean isValidEmail (String email) 54 { 55 return (email != null && emailRE.match(email)); 56 } 57 58 } 59 | Popular Tags |