I am trying to validate pin number ( 6 digits always). I am using,
[0-9]{6}
Which does the job but it makes field compulsory.
How to make it optional?
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.
^ist string start,$is string end, and the()?says: My content exactly once or nothing.However, if I read the spec correctly, and a quick test in FF4 doesn’t deceive me, this might not be necessary, as long as you don’t add the
requiredattribute, too (in which case it would be an error).