08.유효성검사(정리).docx
0.13MB

< 꿀팁. 자주 사용되는 패턴 정리 >

숫자만 ^[0-9]*$

영문자만 ^[a-zA-Z]*$

한글만 ^[가-힣]*$

이메일 /^[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*\%.[a-zA-Z]{2,3}$/i

휴대전화 ^01(?:0|1|[6-9])-(?:\d{3}|\d{4})-\d{4}$

전화번호 ^\d{2,3}-\d{3,4}-\d{4}$

주민번호 \d{6}\-[1-4]\d{6}

IP주소 ([0-9]{1,3})\.[0-9]{1,3})\.[0-9]{1,3})\.[0-9]{1,3})

URL ^(file|gopher|news|nntp|telnet|https?|ftps?|sftp):\/\/([a-z0-9-]+\.)+[a-z0-9]{2,4}.*$

날짜 ^\d{2,4}\/\d{1,2}\/\d{1,2}$

 

http://regexlib.com 

 

Regular Expression Library

Welcome to RegExLib.com, the Internet's first Regular Expression Library. Currently we have indexed 4149 expressions from 2818 contributors around the world. We hope you'll find this site useful and come back whenever you need help writing an expression, y

regexlib.com

 

6. 데이터 형식 유효성 검사

- 사용자가 폼 페이지의 입력 항목에 입력한 데이터 값이 특정 형태에 적합한지 검사하기 위해 정규 표현식을 사용하는 방법

- 특정한 규칙을 가진 문자열의 집합을 표현하는 데 사용하는 형식 언어

- 정규 표현식(regExp)에서 사용하는 기호를 메타 문자라고 함

- 메타 문자는 정규 표현식 내부에서 특정한 의미를 가진 문자

'개발자 > JspSpring' 카테고리의 다른 글

20220119 쿠키  (0) 2022.01.19
20220117 시큐리티  (0) 2022.01.17
20220113 열하나  (0) 2022.01.13
20220110 상품등록페이지 만들기  (0) 2022.01.10
20220107 구구단 출력  (0) 2022.01.07

+ Recent posts