Java

특수문자 제거,이메일 유효성 검사 등등

SeoHW 2015. 8. 31. 18:07
SMALL
//특수문자 제거 하기
   public static String StringReplace(String str){      
      String match = "[^\uAC00-\uD7A3xfe0-9a-zA-Z\\s]";
      str =str.replaceAll(match, " ");
      return str;
   }

 

 
//이메일 유효성
   public static boolean isEmailPattern(String email){
    Pattern pattern=Pattern.compile("\\w+[@]\\w+\\.\\w+");
    Matcher match=pattern.matcher(email);
    return match.find();
   }

 

 
//연속 스페이스 제거
  public static String continueSpaceRemove(String str){
   String match2 = "\\s{2,}";
   str = str.replaceAll(match2, " ");
   return str;
  }
LIST