숫자 4개를 입력 받고 시간 정보인지 확인하는 커스텀펑션 function timeTest(stringInput) { return /^([0-1]?[0-9]|2[0-4])([0-5][0-9])(:[0-5][0-9])?$/.test(stringInput); } console.log(timeTest("0034")); //true