분류
javascript
문자열 내에서 날짜를 검색하는 JavaScript 프로그램 작성하시오.
본문
코드 :
function is_dateString(str)
{
regexp = /^(1[0-2]|0?[1-9])\/(3[01]|[12][0-9]|0?[1-9])\/(?:[0-9]{2})?[0-9]{2}$/;
if (regexp.test(str))
{
return true;
}
else
{
return false;
}
}
console.log(is_dateString("01/01/2015"));
console.log(is_dateString("01/22/2015"));
console.log(is_dateString("32/01/2015"));
- 이전글주어진 값이 IP 값인지 아닌지를 확인하는 JavaScript 함수를 작성하십시오. 17.12.30
- 다음글신용 카드 번호를 확인하는 자바 스크립트 프로그램을 작성하십시오. 17.12.30