From c7939d5209345b270bb27f6f0c61e2a173c0918f Mon Sep 17 00:00:00 2001 From: leebj Date: Mon, 4 Nov 2024 11:10:05 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B0=A8=EB=9F=89=EB=B2=88=ED=98=B8=20?= =?UTF-8?q?=EC=B2=B4=ED=81=AC=20=EB=A9=94=EC=86=8C=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 13 ++----- .../java/cokr/xit/applib/AppCmmnUtil.java | 38 +++++++++++++++++++ 2 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 src/main/java/cokr/xit/applib/AppCmmnUtil.java diff --git a/pom.xml b/pom.xml index 4ae3399..36b657c 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ app-support-java app-support-java jar - + UTF-8 17 @@ -23,7 +23,7 @@ - + maven-public @@ -36,8 +36,8 @@ - - + + cokr.xit.base @@ -49,11 +49,6 @@ xit-docs 23.04.01-SNAPSHOT - - cokr.xit.base - xit-user - 23.04.01-SNAPSHOT - diff --git a/src/main/java/cokr/xit/applib/AppCmmnUtil.java b/src/main/java/cokr/xit/applib/AppCmmnUtil.java new file mode 100644 index 0000000..ab2e62f --- /dev/null +++ b/src/main/java/cokr/xit/applib/AppCmmnUtil.java @@ -0,0 +1,38 @@ +package cokr.xit.applib; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class AppCmmnUtil { + + /** + * 문자열이 차량번호인지 체크한다. + * @param 문자열 + * @return boolean + */ + public static boolean isValidCarNumber(String carNum){ + boolean returnValue = false; + try{ + String regex = "^\\d{2,3}[가|나|다|라|마|거|너|더|러|머|버|서|어|저|고|노|도|로|모|보|소|오|조|구|누|두|루|무|부|수|우|주|바|사|아|자|허|배|호|하\\x20]\\d{4}/*$"; + + Pattern p = Pattern.compile(regex); + Matcher m = p.matcher(carNum); + if (m.matches()) { + returnValue = true; + }else{ + //2번째 패턴 처리 + regex = "^[서울|부산|대구|인천|대전|광주|울산|제주|경기|강원|충남|전남|전북|경남|경북|세종]{2}\\d{2}[가|나|다|라|마|거|너|더|러|머|버|서|어|저|고|노|도|로|모|보|소|오|조|구|누|두|루|무|부|수|우|주|바|사|아|자|허|배|호|하\\x20]\\d{4}$"; + p = Pattern.compile(regex); + m = p.matcher(carNum); + if (m.matches()) { + returnValue = true; + } + } + + return returnValue; + + }catch(Exception e){ + return false; + } + } +}