전화번호 형식 체크 수정

main
이범준 1 week ago
parent 541a8fd8a6
commit cb7ac7d786

@ -102,14 +102,54 @@ public class CmmnUtil {
return Pattern.matches(REGEXP_PATTERN_KOR, str); return Pattern.matches(REGEXP_PATTERN_KOR, str);
} }
/**
* (,) .
* @param
* @return boolean
*/
public static boolean isTelno(String str) {
//01X
String REGEXP_PHONE = "^(01)\\d{8,9}$";
if(Pattern.matches(REGEXP_PHONE, str)) {
return true;
}
//서울
String REGEXP_TEL = "^(02)\\d{7,8}$";
if(Pattern.matches(REGEXP_TEL, str)) {
return true;
}
//지방
REGEXP_TEL = "^(0)(3|4|5|6)\\d{8,9}$";
if(Pattern.matches(REGEXP_TEL, str)) {
return true;
}
//070
REGEXP_TEL = "^(070)\\d{7,8}$";
if(Pattern.matches(REGEXP_TEL, str)) {
return true;
}
//전국대표번호(0000-0000)
REGEXP_TEL = "^\\d{8}$";
if(Pattern.matches(REGEXP_TEL, str)) {
return true;
}
return false;
}
/** /**
* . * .
* @param * @param
* @return boolean * @return boolean
*/ */
public static boolean isReceivePhone(String str) { public static boolean isReceivePhone(String str) {
String REGEXP_SENDABLE_PHONE = "^(010)\\d{7,8}$"; String REGEXP_PHONE = "^(01)\\d{8,9}$";
return Pattern.matches(REGEXP_SENDABLE_PHONE, str); return Pattern.matches(REGEXP_PHONE, str);
} }
/** /**

Loading…
Cancel
Save