Regular Expression Validation

About Regular Expression Validation

A regular expression (RegEx) is a sequence of characters that is used to validate specific string formats in user input. Therefore, regular expressions are generally used to ensure the data collected is formatted properly.

Input Field questions and Text Background Variables have custom formats that allow you to create your own validation by using RegEx. For example, you can validate Input Field questions and Text Background Variables to only collect San Francisco zip codes, LinkedIn links, etc.

Useful Regular Expressions

We've compiled a few helpful RegEx patterns:

  • Match only Gmail addresses: [^ ]*@gmail\.com$
  • Match only letters, numbers and spaces - exclude special characters: ^[a-zA-Z0-9 ]+$
  • Time in 24 hour format: ^([0-1]?[0-9]|2[0-4]):([0-5][0-9])(:[0-5][0-9])?$
  • Match only postcodes in The Netherlands: ^\d{4}\s?\w{2}$

Helpful Resources

To browse through commonly used regular expression patterns, check out this website: RegExLib.

If you want to create your own, here is a cheat sheet and here you can test your own regular expressions.

Was this article helpful?

2 out of 6 found this helpful