Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js regex validate phone number

My regex of choice is:

/^[+]?[(]?[0-9]{3}[)]?[-s.]?[0-9]{3}[-s.]?[0-9]{4,6}$/im
Valid formats:

(123) 456-7890
(123)456-7890
123-456-7890
123.456.7890
1234567890
+31636363634
075-63546725
Comment

phone number validation regex javascript

// regex to match phone numbers entered with delimiters (spaces, dots, brackets, etc.)

/^+?d{1,4}?[-.s]?(?d{1,3}?)?[-.s]?d{1,4}[-.s]?d{1,4}[-.s]?d{1,9}$/
Comment

regular expression javascript for phone number


// below is the regular expression worked for me in javascript
/^(((d{3})))[ ]d{3}[-]d{4}$/;
only accepts the number in the format like 
(###) ###-####
 Below are the exmples 
- (123) 123-3456
- (111) 234-4556


function isValidPhoneNumber(p) {
  var phoneRe = /^(((d{3})))[ ]d{3}[-]d{4}$/;
  return phoneRe.test(p);
}

you can call above function  with below code
var isValid= isValidPhoneNumber("(123) 123-3456)");

Comment

regex to check the phone number javascript

//To check that the phone number is of 10 digits
let regex=/^[0-9]{10}$/;
Comment

javascript regex check phone number

let pattern = /^[62|0]+d{10}/gi
let phone = '087887242822'
console.log(pattern.test(phone))
Comment

how to validate phone number regex javascript

/^d{3}(-|s)d{3}(-|s)d{4}$|^d{10}$|^1sd{3}(-|s)d{3}(-|s)d{4}$|^(1s?)?(d{3})(s|-)?d{3}-d{4}$/
Comment

PREVIOUS NEXT
Code Example
Javascript :: react native curved view 
Javascript :: timestamp js 
Javascript :: how to truncate string in javascript 
Javascript :: fb login npm 
Javascript :: give div event listener functional component 
Javascript :: radio button default checked react 
Javascript :: how to know type of dom element in js 
Javascript :: sweetalert angular 8 
Javascript :: npm package for sorting in reactjs 
Javascript :: Uncaught ReferenceError: function is not defined at HTMLUnknownElement.onclick 
Javascript :: javascript escape quote method 
Javascript :: jsonobject gradle dependency 
Javascript :: change list of objects to list js 
Javascript :: js clamp 
Javascript :: js redirect 
Javascript :: location javascript redirect 
Javascript :: vehicle number yup validation 
Javascript :: function expression and function declaration 
Javascript :: binary search in js 
Javascript :: javascript open new window and pass data 
Javascript :: how to access model data in jsp spring mvc 
Javascript :: react native transform 
Javascript :: jquery page finished loading 
Javascript :: check if not checked vanila js 
Javascript :: array unique values javascript 
Javascript :: javascript remove clicked table row from table 
Javascript :: javascript integer length 
Javascript :: replace all dashes to slashes using jquery in a string 
Javascript :: react construct 
Javascript :: focus js 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =