How to validate the phone number in the form field to be in this format: XXX-XXX-XXXX | XM Community
Skip to main content
Solved

How to validate the phone number in the form field to be in this format: XXX-XXX-XXXX

  • May 7, 2021
  • 1 reply
  • 1247 views

Hello all!
How to validate the phone number in the form field to be in this format: XXX-XXX-XXXX
Thank you in advance.

Best answer by Mishraji

Add a custom validation to match the following regex:
/[0-9]{3}-[0-9]{3}-[0-9]{4}$/

1 reply

Mishraji
Level 4 ●●●●
Forum|alt.badge.img+18
  • Level 4 ●●●●
  • Answer
  • May 17, 2021

Add a custom validation to match the following regex:
/[0-9]{3}-[0-9]{3}-[0-9]{4}$/