Posted By

nialace on 11/21/10


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

alexvezeau


verification email


 / Published in: Java
 

verification of email format with regex

  1.  
  2. java.util.regex.Pattern p = java.util.regex.Pattern.compile("^[a-zA-Z]+[a-zA-Z0-9\\._-]*[a-zA-Z0-9]@[a-zA-Z]+"
  3. + "[a-zA-Z0-9\\._-]*[a-zA-Z0-9]+\\.[a-zA-Z]{2,4}$");
  4. java.util.regex.Matcher m = p.matcher(value);
  5.  
  6.  
  7.  
  8. if(m.find())
  9. System.out.println("ok");
  10. else
  11. System.out.println("ko");

Report this snippet  

You need to login to post a comment.