기본
-
정규표현식 - 1JAVA/정규표현식 2023. 5. 1. 11:16
1. 정규표현식이란? 문자열의 특정 규칙 / 패턴 등을 표현한 언어이다. 주로 문자열 치환, 검색 등의 동작을 할 때, 단순히 문자열들을 1 대 1 비교하는 것이 아니라, 하나의 정규표현식 문자열이 >>>> 특정 패턴(ex 주민등록번호/ url / email ...)을 비교할 수 있다. 2. 자바의 정규표현식 정규표현식을 완성하기 위해서는 3가지 준비가 필요하다 정규표현식 비교하고자하는 입력 문자열 자바에서 제공하는 2개의 클래스 자바는 java.util.regex 에서 관련 클래스를 제공한다. Pattern Matcher import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static void..