regex valid phone number code example

Example 1: phone number regex

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

Example 2: phone number regex

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

Example 3: regex pattern for mobile number

/^(\+\d{1,3}[- ]?)?\d{10}$/

Example 4: 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+))?$

Example 5: Extract phone number from text regex

\(?\b[2-9][0-9]{2}\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}\b

Tags:

Html Example