Skip to main content
Skip table of contents

Phone Number Validation

  1. Edit your existing survey, or create a new survey.

  2. If editing an existing question, click the Edit button next to your question. To create a new question click Insert > New Question.

  3. Select the Single line text with pre-format options question type.

  4. Enter your question's text and answer choices. We will show you how to create a question that will allow respondents to enter only phone numbers of the following types: (756)123-4567 or (756)123-4567 ext.123

  5. Select the Format Answers check box.

  6. Click the Customize Formats button.

  7. Click the New Format button to create a new value type.

  8. The Customize Format page shows a list of your custom formats which can be edited or deleted.

If you delete a format, you delete it permanently and this format will not be available for all questions and surveys of your account.

9. Select Text as the content type.

10. Name your format.

11. Enter the alert text so your respondents are notified if the answer they provide does not meet expected format. (i.e. Please use one of the following formats: (XXX)XXX-XXXX or (XXX)XXX-XXXX

12. Set the Character limit Between 0 and 25, this will allow for 10 digits to be answered as phone number, the other 15 characters are used for extra symbols such as brackets, hyphens, spaces and extension indicating.

13. Set the field width for 25 characters

14. Enter your regular expression. This will set the formatting for the acceptable answers. 


Our expression will be as follows \(\d{3}\)\s?\d{3}\s?-\s?\d{4}\s?(\w+\.?\s?\d+)*, where:

  • \( and \) stand for brackets, \ is used to interpret () as simple brackets;

  • \d{3} refers to the sequence of three digits (numbers 0 to 9);

  • \d{4} refers to the sequence of four digits (numbers 0 to 9);

  • \s? means that there can be no spaces or only one space;

  • \w+ means that there can be one or more letters which allows entering extension;

  • \d+ means that there can be one or more digits (numbers 0 to 9) which allows entering extension's numbers;

  • \.? stands for the dot, \ is used to interpret . as a simple dot and it means that there can be no dots or only one dot;

  • (\w+\.?\s?\d+)* means that the combination of letters and numbers can occur many times or never at all, so your respondents may input straight phone number or phone number with an extension if any.

15. To test your format, input a value into appropriate text box and click the Test button.

16. Click the Save button to save your new format.

17. Click Back to return to the question creation page.

18. Select the format you have just created next to the answer choice.

19. Click Save to save your question with pre-format answer choice.

20. Now you will be brought back to your Edit Questions page. 

21. Click the Preview button to preview your survey and test the question for which regular expression has been created.

22. Test your newly created Regular Expression by entering phone number in specified format. 

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.