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 :: reactjs make main div scrollable 
Javascript :: javascript string to float 
Javascript :: convert nodes to array javascript 
Javascript :: check if a column is unique sql 
Javascript :: jquery validation plugin google recaptcha 
Javascript :: set min date field to current date 
Javascript :: validate email input javascript onchange 
Javascript :: get date javascript 
Javascript :: format money javascript 
Javascript :: get value of ajax success in variable 
Javascript :: socket io close client connection 
Javascript :: factorialization in javascript 
Javascript :: jquery window offset top 
Javascript :: toggle class javascript 
Javascript :: Remove duplication from array in javascript 
Javascript :: how to get a record in dynamodb nodejs 
Javascript :: js document.addEventListner 
Javascript :: javascript contains substring 
Javascript :: loop in object javascript 
Javascript :: javascript change nan to 0 
Javascript :: async for loop 
Javascript :: radiojquery 
Javascript :: generate component react 
Javascript :: js strict mode 
Javascript :: js-cookie set expiration of cookie 
Javascript :: us phone number regex 
Javascript :: how to print numbers from 1 to 100 in javascript 
Javascript :: import all from javascript 
Javascript :: how to disable copy paste in input js 
Javascript :: javascript credit card validation 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =