Regex is a short form for Regular Expressions (more info:
Regular-Expressions.info - Regex Tutorial, Examples and Reference - Regexp Patterns) They are used to "match" on a number of different patterns that might be input into a form. In ProntoForms there are 2 places where Regex can and should be used when possible. We will cover both of those applications and a few tips and tricks for building out those Regular Expressions in this article.
- Answer Validation - see Custom Validation (Data Type: Free Text) Using Regex as a custom validation method allows you to be 100% certain that the information that is being input into the form is exactly what you are expecting. If you want to make sure that the number they input starts with a 2, regex can do that. Make sure that there are 5 characters (no more - no less), regex can do that. We can not put examples of all the different ways to use Regex to perform this validation but there is tons of information online about it.
- Data Destination Filtering - see Custom Filter Rules (Applying Filtering to Data Destinations) We can also use Regex when applying a filter to a data destination to determine if the destination will get triggered or not. All the same rules apply here as they do in the Custom Validation.
Some things to note. When dealing with Regex, you will almost always want the start of the expression to be a ^ (which indicates the beginning of a string) and end your expression with a $ (meaning the end of the string). From there, you can use a tool like
RegExr: Learn, Build, & Test RegEx to figure out if the expression that was built is going to match the strings that you put in the form. When you are first trying to come up with your expression - I would always suggest a quick google search because with the complexity of Regex expressions, no doubt someone has the expression figured out that you need.
------------------------------
Ian Chamberlain
Implementation Specialist
ProntoForms
------------------------------