Javascript Regex Literal:
US Zip Codes: /(^\d{5}$)|(^\d{5}-\d{4}$)/
var isValidZip = /(^\d{5}$)|(^\d{5}-\d{4}$)/.test("90210");
Some countries use Postal Codes, which would fail this pattern.
More Related Contents:
- What’s the best way to validate an email address in JavaScript?
- How can I check if a string is a valid number?
- HTML5 form required attribute. Set custom validation message?
- JavaScript file upload size validation
- How to get the raw value an field?
- Regex pattern to match at least 1 number and 1 character in a string
- How to validate date with format “mm/dd/yyyy” in JavaScript?
- How can I listen to the form submit event in javascript?
- How to validate inputs dynamically created using ng-repeat, ng-show (angular)
- Check whether an input string contains a number in javascript
- Validate decimal numbers in JavaScript – IsNumeric()
- Javascript: how to validate dates in format MM-DD-YYYY?
- How do I remove javascript validation from my eclipse project?
- Validate phone number using javascript
- Safari JS cannot parse YYYY-MM-DD date format?
- Parsing numbers with a comma decimal separator in JavaScript
- show validation error messages on submit in angularjs
- Check if HTML snippet is valid with JavaScript
- HTML/JavaScript: Simple form validation on submit
- Why do we need both client side and server side validation? [closed]
- AngularJS: How do I manually set input to $valid in controller?
- How to show setCustomValidity message/tooltip without submit event
- How to set custom validation messages for HTML forms?
- Trigger standard HTML validation (form) without using submit button? [duplicate]
- JS check for valid date format
- Max characters in textarea with jquery
- Form Validation With Bootstrap (jQuery)
- JavaScript validation issue with international characters
- Is there a way to validate dynamic key names in a Joi schema?
- Why does setting ng-model to undefined not make the form/input valid again?