Skip to content

Instantly share code, notes, and snippets.

@ppillip
Created December 8, 2016 07:48
Show Gist options
  • Save ppillip/1413e11d6c5f0c22cb9036902c7c2640 to your computer and use it in GitHub Desktop.
Save ppillip/1413e11d6c5f0c22cb9036902c7c2640 to your computer and use it in GitHub Desktop.
패턴 파일을 만들어 보세요
NotEmptyString = Match.Where((x)=>{
check(x , String) ;
return x.length > 0 ;
});
/* 이메일 */
EmailString = Match.Where((x)=>{
check(x,String);
return /^([0-9a-zA-Z_\.-]+)@([0-9a-zA-Z_-]+)(\.[0-9a-zA-Z_-]+){1,2}$/.test(x);
});
/* 전화번호 : “000-0000-0000” */
PhoneString = Match.Where((x)=>{
check(x,String);
return /^\d{3}-\d{3,4}-\d{4}$/.test(x);
});
/* 특정 날짜 형식 : “yyyy/mm/dd” */
BirthDayString = Match.Where((x)=>{
check(x,String);
return /^(19[0-9][0-9]|20\d{2})\/(0[0-9]|1[0-2])\/(0[1-9]|[1-2][0-9]|3[0-1])$/.test(x);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment