Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

^(?:(+|00)d{1,3}[-s.])?(()?d{3,10}())?(?:[-s.)]d{2,7}([-s.]d{2,5})?([-s.]d{2})?)?$

// regular expression in Javascript looking for matching phones 
let phones = [
    "+1-234-567-8901",
    "+41-234-567-89-01",
    "+33-234 5678901",
    "+1 (234) 568 9901",
    "+30.234.567.8901",
    "001 234 56 78901",
    "001 234 567 8901",
    "+1 6134138417",
    "800-123-4567",
    "(800) 123 4567",
    "(212)867-5509"
]

const regex = new RegExp(/^(?:(+|00)d{1,3}[-s.])?(()?d{3,10}())?(?:[-s.)]d{2,7}([-s.]d{2,5})?([-s.]d{2})?)?$/, 'i');

phones.forEach(phones => console.log(phones, regex.test(phones)));
Comment

PREVIOUS NEXT
Code Example
Javascript :: Cannot download "https://github.com/sass/node-sass 
Javascript :: nextjs websocket.js?a9be:46 WebSocket connection to 
Javascript :: adonisjs livereload 
Javascript :: work gants noir nitrile 
Javascript :: Inject Javascript Function not working in Android React Native WebView but work fine in iOS React Native 
Javascript :: adonisjs findorcreate 
Javascript :: angular reactive input required based on previous value 
Javascript :: default error handler express 
Javascript :: how to shuffle an array in js 
Javascript :: xmlhttprequest post form 
Javascript :: commas for thousands js 
Javascript :: first remove active class from classlist and append to current element using javascript 
Javascript :: expo android package name 
Javascript :: postman scripts check variable exists 
Javascript :: set default terminal vscode windows 
Javascript :: move an element into another jquery 
Javascript :: how to revers bulain in js 
Javascript :: drm react native 
Javascript :: convert hsl to hex code javascript 
Javascript :: node js get files in dir 
Javascript :: javascript match number 
Javascript :: keyup addeventlistener 
Javascript :: protractor screen size 
Javascript :: how to delete all slash command discord.js 
Javascript :: javascript add class to all child elements 
Javascript :: download image from url javascript 
Javascript :: simulate a user click 
Javascript :: tomodachi 
Javascript :: draw text in js 
Javascript :: get element size javascript 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =