regex match phone number code example

Example 1: phone number regex

^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$

Example 2: indian phone pattern regex

pattern:
^(?:(?:\+|0{0,2})91(\s*[\ -]\s*)?|[0]?)?[456789]\d{9}|(\d[ -]?){10}\d$


//Valid Scenarios:
4567589390
5678896759
6788509595
+91-9883443344
9883443344
09883443344
919883443344
0919883443344
+919883443344
+91-9883443344
0091-9883443344
+91 -9883443344
+91- 9883443344
+91 - 9883443344
0091 - 9883443344
7856128945
9998564723
022-24130000
080 25478965
0416-2565478
08172-268032
04512-895612
02162-240000
+91 9883443344
022-24141414


//Invalid Scenarios:
WAQU9876567892
ABCD9876541212
0226-895623124
6589451235
0924645236
0222-895612
098-8956124
022-2413184

Example 3: phone number regex

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

Example 4: valid phone number regex with country code

((00)?(\+)?\d{1,3})[-\s]+(\d{1,3})[-\s]+(\d{4,10})

Example 5: general phone number regex

^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$