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

// 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

validate phone number regex

// Commonly used regular expression

// Check 2-9 characters, false if not matched, true if matched
const validateName = (name) => {
   const reg = /^[u4e00-u9fa5]{2,9}$/;
   return reg.test(name);
};
// Verify phone number
const validatePhoneNum = (mobile) => {
   const reg = /^1[3,4,5,6,7,8,9]d{9}$/;
   return reg.test(mobile);
};
// Check passwords consisting of 6 to 18 uppercase and lowercase alphanumeric underscores
const validatePassword = (password) => {
   const reg = /^[a-zA-Z0-9_]{6,18}$/;
   return reg.test(password);
};
Comment

javascript regex check phone number

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

phone number validation regex

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

Matches the following

123-456-7890
(123) 456-7890
123 456 7890
123.456.7890
+91 (123) 456-7890
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 :: how to take create array using jquery 
Javascript :: js go back 
Javascript :: javascript generate a random integer number in a range of numbers 
Javascript :: socket.io.js file download 
Javascript :: hide element when pressing button angular 
Javascript :: javascript word start with 
Javascript :: display image base64 in REACT NATIVE 
Javascript :: js sort by name 
Javascript :: jest global window object 
Javascript :: node js check if a user exists in mysql 
Javascript :: javascript give class to element 
Javascript :: get part of string javascript 
Javascript :: disable radio button javascript 
Javascript :: npm express async handler 
Javascript :: change js to json 
Javascript :: how to truncate string in javascript 
Javascript :: vue watch deep property 
Javascript :: python get json content from file 
Javascript :: json watch command 
Javascript :: add an image to a div with javascript 
Javascript :: mongoose connect to URL of atlas 
Javascript :: js redirect 
Javascript :: redirect to another domain javascript 
Javascript :: hhow to check input is null in html using js 
Javascript :: URL scheme "localhost" is not supported. 
Javascript :: component unmount useeffect 
Javascript :: sequelize update record 
Javascript :: match any character across multiple line regex 
Javascript :: hide and show in angular 8 
Javascript :: hide and show modal jquery 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =