I want to validate a zipcode either 5 digit or 9 digit.
I’ve written this /^(\d){5|9}$/ but its not matching anything.
But when i give /^(\d){5}$/ its matching properly for 5.
Please help.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Make the last four optional:
Note that I removed the opening/closing slashes as they have nothing whatsoever to do with regex; they are an application language artefact.