javascript - Date regex of format mm/yyyy is not working -
javascript - Date regex of format mm/yyyy is not working -
i new regex. using regex '^((0?[1-9]|1[012])[- /.](20)?[0-9]{2})$'
validate credit card expiry date in mm/yyyy format.
this javascript function checks regex , give me response in true or false.
function isvalidthrudate(valid_till){ var regex = new regexp('^((0?[1-9]|1[012])[- /.](20)?[0-9]{2})$'); homecoming regex.test(valid_till); }
but whenever pass date, gives me false in return. unable figure out problem.
function isvalidthrudate(valid_till){ homecoming /^((0?[1-9]|1[012])\s*(?:[-/.]\s*)?(20)?[0-9]{2})$/.test(valid_till); }
javascript regex date
Comments
Post a Comment