jam 블로그

정규표현식 패턴(유용한 것) 본문

개발 및 관련 자료/쉘 스크립트

정규표현식 패턴(유용한 것)

kid1412 2010. 11. 9. 10:56
728x90
출처 : http://lambert.tistory.com/171
EMAIL:

^[\w\-\+\&\*]+(?:\.[\w\-\+\&\*]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$ 

CREDIT CARD:
^((4\d{3})|(5[1-5]\d{2})|(6011))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$ 

MAC ADDRESS :
^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$ 

IP ADDRESS :
^\b((25[0-5]|2[0-4]\d|[01]\d\d|\d?\d)\.){3}(25[0-5]|2[0-4]\d|[01]\d\d|\d?\d)\b$ 

REASONABLE DOMAIN NAME:
^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$

Comments