regex for e.164 phone number
matches a valid e.164 format telephobne number
^\+[1-9]\d{1,14}$
Regex Flags
global match
?
ignore case
?
multiline
?
dotAll
?
unicode
?
sticky
?
+919367788755
8989829304
+16308520397
786-307-3615
+14155552671
+551155256325
E.164 is a telephone number format to ensure consistency
E.164 numbers are formatted as: [+] [country code] [subscriber number including area code]
And can have a maximum of fifteen digits.
Cheatsheet
expr | usage |
---|---|
/\d/ | matches any digit |
/\w/ | matches any word character (a-z, A-Z, 0-9, _) |
/[0-9]/ | matches all digits |
/(hello){1,3}/ | matches "hello" that occur between 1 and 3 times (inclusive) |
iHateRegex
by
geon