Help needed with Regex Code | XM Community
Question

Help needed with Regex Code

  • 5 February 2021
  • 2 replies
  • 12 views

Userlevel 1
Badge +3

Can someone please help me to write a regex code so that I can validate a phone number to be a Mexico Phone Number?


2 replies

Userlevel 7
Badge +21

Regex is pattern matching. Do you have a list of "Mexico phone number" patterns?

Userlevel 1
Badge +3

Thanks for the response Ahmed. Validity for Mexico Phone Number would be, it should be 10 digits long. However, the tricky part is first 2/3 digits would be the area code. For example -
Guadalajara numbers starts with 33
Mexico City with 55/56
Durango with 618, etc.

Leave a Reply