diff --git a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java index 37c5beef..7bfac8c4 100644 --- a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java @@ -102,14 +102,54 @@ public class CmmnUtil { 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 문자열 * @return boolean */ public static boolean isReceivePhone(String str) { - String REGEXP_SENDABLE_PHONE = "^(010)\\d{7,8}$"; - return Pattern.matches(REGEXP_SENDABLE_PHONE, str); + String REGEXP_PHONE = "^(01)\\d{8,9}$"; + return Pattern.matches(REGEXP_PHONE, str); } /**