I would like to create custom validation for us phone numbers

sheardlnsheardln Oxford, OhioCommunity Member Qubie ✭

I would like to create custom validation for us phone numbers

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!

Tagged:

Best Answer

  • TomGTomG Raleigh, NC Wizard ✭✭✭✭✭
    edited March 2018 Accepted Answer

    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}$

Answers

  • Michael_Campbell_RedPepperMichael_Campbell_RedPepper Pleasant Grove, UTQualtrics Partner Sage ✭✭✭

    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!

  • sheardlnsheardln Oxford, OhioCommunity Member Qubie ✭

    Thanks to both of you! I was using something similar, but the string that TomG provided works perfectly! Yay!

Sign In to Comment