Regular expressions in terms

Difficulty level: Difficult

What does the functionality do?

Regular expressions, also called RegEx, are a description of a sequence of characters that define a search pattern. A more detailed explanation, including a description of the syntax, can be found here:

NOTE: Regular expressions can only be used on input fields with the datatype Text (None). This means no direct validation can be applied to the input field.

On this page we will show some frequently used regular expressions. They can be used for validations and filters.

Use cases and how to set them up?


Example: ES7921000813610123456789


Germany (with or without spaces)
Example: DE89 3704 0044 0532 0130 00 or DE89370400440532013000

^DE\d{2}[ ]\d{4}[ ]\d{4}[ ]\d{4}[ ]\d{4}[ ]\d{2}|DE\d{20}$

Switzerland (with or without spaces)
Example: CH93 0076 2011 6238 5295 7 or CH9300762011623852957 or CH9300SURVALYZER0000X

^CH\d{2}[ ][A-Z0-9]{4}[ ][A-Z0-9]{4}[ ][A-Z0-9]{4}[ ][A-Z0-9]{4}[ ][A-Z0-9]{1}|CH\d{2}[A-Z0-9]{17}$

Example: NL91ABNA0417164300



This is the standard regular expression using the RFC 5322 Official Standard:


Phone numbers

Allows several formats:
Examples: 004989123456, +49 89 123456, +49(89)123456, 089-1234-5678, 089 1234 5678, (089)1234-5678

^(((((((00|\+)49[ \-/]?)|0)[1-9][0-9]{1,4})[\-/]?)|((((00|\+)49\()|\(0)[1-9][0-9]{1,4}\)[ \-/]?))[0-9]{1,7}([\-/]?[0-9]{1,5})?)$

Allows several formats:
Examples: 044 276 47 44, +41442764744, 00412764744, +41 44 276 47 44


Allows several formats:
Examples: 0612345678, +31612345678, 0031612345678, +31(0)61 234 5678


Allows several formats:
Examples: 089 123 4567/8, 0041-44-276-4744, +


ZIP codes

Example: 24143


Example: 5033


Example: 1000AB


If, in an open question, only the following postal codes may be entered by a participant: 3131, 3132, 3133, 3134, 3135, 3136, 3137 and 3138, you can use, for example, the following regular expression:



When you are asking a participant for his/her year of birth in a survey, you can use an open question with the response data type None (Text) for this. You can define an upper and lower limit for this birth year. This can be done by means of a regular expression. Suppose a participant enters the year 2010 while you have indicated using a regular expression that the year of birth should be between 1900 and 2007, then the validation fails and the participant will have to enter another year of birth until the validation is successful.

After you have included an open question asking for the year of birth, you can add a validation element to the survey. In this element, you can record the following information:

  • The error message a participant will see when he/she enters a year of birth that is NOT between the defined period (here: 1900 up to 2007).
  • The filter condition on the Filter window which you can launch using the Edit conditions button. The condition can then look like this:
    • Hide this validation message
    • if – Question – q3 What is your year of birth? – matches Regex – ^(19[0-9]\d|200[0-7])$

In order to save the filter condition, you obviously still need to click the green Save changes button.


  • Year must be between 1900 and 2099: ^(19|20)\d{2}$
  • Year must be between 1900 and 2007: ^(19[0-9]\d|200[0-7])$
  • Year must be between 1950 and 2030: ^(19[5-9]\d|20[0-2]\d|2030)$
  • Year must be between 1945 and 2023: ^(194[5-9]|19[5-9]\d|200\d|201\d|202[0-3])$
  • Year must be between 1935 and 2023: ^(193[5-9]|19[4-9]\d|200\d|201\d|202[0-3])$

Updated on November 18, 2022

Was this article helpful?

Related Articles

Need Support?
Please login to your Survalyzer account and use the "Create Support Request" form.
Login to Survalyzer