showing results for - "how to validate a string using regular expression in javascript"
María Paula
22 Jun 2019
1function validate(){
2  var phoneNumber = document.getElementById('phone-number').value;
3  var postalCode = document.getElementById('postal-code').value;
4  var phoneRGEX = /^[(]{0,1}[0-9]{3}[)]{0,1}[-\s\.]{0,1}[0-9]{3}[-\s\.]{0,1}[0-9]{4}$/;
5  var postalRGEX = /^[A-Z]{1,2}[0-9]{1,2} ?[0-9][A-Z]{2}$/i;
6  var phoneResult = phoneRGEX.test(phoneNumber);
7  var postalResult = postalRGEX.test(postalCode);
8  alert("phone:"+phoneResult + ", postal code: "+postalResult);
9}
10
11
queries leading to this page
how to check regular expression in jsjavascript for regex validationregex for string validation in javascripttext validation in javascript regxregex validation pattern javascripthow to validate with regex in javascriptvalidate with regex jsregular expression javascript validationjavascript validate by regexregular expression validation in javascript html feildsjavascript validate regexhow to validate regular expression in javascripthow to validate with a regex javascriptregular expression in javascript validateexamplejavascript regex validate patternvalidate string using regex javascriptvalidate mathematical expression in javascript using regexhow to validate string with regex in javascriptregex valid strings in input javascriptjavascript validate string regular expressionjs validation regular expressionvalidate using regular expression in javascriptjavascript regex validate stringjavascript regular expression validationjs validate regexvalidate text regex jsvalidate a regular expression in form validation in javascriptcheck regular expression in javascriptregex validator in javascriptvalide string with regex jsregex javascript validation how to use regex validation in javascript examplehow to validate name format javascript using regular expressionregular expression validate in jsjavascript regex validation exampleusing regular expression for form validation in javascripttext validation in javascript using regular expressionjs regular expression for validation examplevalidate text with regex javascripthow to validate input with regular expression in javascriptvalidate string regex javascriptjs string to valid regexhow to check for regular expression in javascriptregular expression javascript form validationcan i use regex in 24 28 29regex form validation javascriptvalid regex javascript regular expression for name field in javascript validationuse regex in javascript validationvalidate string with regex javascriptvalidate expression regular javascriptsimple from validation with regex javascriptvalidate against a regex javascriptjavascript regular expression to check for patterns and validate the dataregular expression for name field in javascript validationchecking for regular expression in javascriptregular expression character validation in javascriptregex validate string javascriptjavascript form validation with regular expressionvalidate with regex javascripthow to validate name in javascript using regular expressionregular expression checking in javascriptvalidate regex javascriptvalidate using regex jsvalidate with regex in javascriptcreate a regular expression for a string validation in javascriptbasic regex form validatoion in javascriptregular expressions in js to validate a string test functionregular expression for string validation in javascriptregex expression validation javascripthow to validate using regex in javascriptcheck if something is valid string regex javascriptvalidate form using regular expressions javascripthow to validate regex in javascript regular expressions in js to validate formusing regular expression in javascript for validationhow to use regex in javascript for validationvalidation regex with javascriptis valid regex javascriptusing regex to validate string javascript regular expressionhow to check string in jsregex string validation in javascriptjavascript form validation regexregular expresion validation in java scriptjs valid regexjs regex validatorform validation in javascript using regular expressionjavascript form validation with regexform validation using regex in javascriptregular expression validation with javascripthow to check regular expression in javascriptvalid regex in jsvalidate regex in javascriptregular expressions in js to validate a stringcheck string with regular expression in javascriptvalidation javascript regexregex validate jsform validation javascript regexjavascript regex validatevalidate javascript regular expressionregular expression for javascript validationhow to validate a string using regex in javascritform validation with regular expression in javascriptjavascript to validate regexcheck if something is valid string in regex javascripthow to check if a regex pattern is valid javascripthow to validate regex jsregex validation in javascriptjavascript validate string with regexjavascript validation using regular expressionjavascript regex form validationhow to validate a string using regular expression in javascript