×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
1
Language: Java
Posted by: Karthick Bala
Added: Jul 25, 2014 10:35 AM
Views: 1778
Tags: no tags
  1.     public static boolean isEmailValid(String value) throws Exception{
  2.         // Trim the email id before checking whether it is valid or not.
  3.         if(value != null && value.equals("")){
  4.              return true;
  5.         }else{
  6.             String pattern= "^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$"; // No I18N
  7.             if(value.matches(pattern)){
  8.                    return true;
  9.             }else{
  10.                   return false;
  11.             }
  12.         }
  13.     }