Regex of Phone number?

could you please provide the regex  of  phone numbers . ex: 9542569841 8340860380 7756894581 6458745554.
2 answers

You could take a look at the Phone Number Validator module in the Market Place.

If you want a regex for 10 digits not starting with zero you could try something like:




The following regex would do the trick:


Explanation of the regex:

  • ^ matches the start of the string
  • \d matches any digit (0-9)
  • {10} specifies that there should be exactly 10 digits
  • $ matches the end of the string


Note that this regex assumes that the phone numbers are in the correct format and do not contain any spaces, dashes, or parentheses. If the phone numbers are in a different format, the regex would need to be adjusted accordingly.