public static final String REGEX_ADDRESS_ZIP = "^[0-9\\ -.]+$";
The above regex for validating zip code seems to allow exclamation (!) even though I haven’t allowed it here. Not sure what the mistake is? Do I need to change the regex pattern
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.
The hyphen
-is a metacharacter inside character classes unless it is the first or last character. Change it to:[0-9\\ -.]means any character from0to9(all digits), the backslash\, and any character from space (ASCII 32) to period (ASCII 46) which translates to: