I would like to create custom validation for us phone numbers | XM Community
Skip to main content
I would like to create custom validation so that respondents have to enter their phone number in the following fomat: (xxx)xxx-xxxx. I have tried using a custom validation with a regex statement, but it doesn't seem to work. Am I missing something? Thanks!
For sure! What Regex statement did you use? @TomG had a cool library that he uses in Javascript if you're able to use that. It's called Cleave.js. If not, we can get you the right Regex String!
If you want to go the custom validation route, here is a simple regex string (doesn't do any checking for valid area code or anything): `^\\([0-9]{3}\\)[0-9]{3}\\-[0-9]{4}$`
Thanks to both of you! I was using something similar, but the string that TomG provided works perfectly! Yay!

Leave a Reply