Sheetgo Forms configurations allow you to set the appearance and behavior of your form. You can modify field types and establish dynamic default values. Additionally, you can build custom validations using regular expressions with the [regex:]
configuration.
A regular expression is a sequence of characters that specifies pattern to match in texts. You can use it in the form configuration to set specific rules or patterns that need to be followed to fill out a field.
Use cases for regular expressions
You can specify that the field requires a specific word, letter, or number, and even use regex metacharacters to create patterns that match a wide range of variations. If the entered information doesn't meet the criteria, the user will see an Invalid information alert.
Here are some examples:
Required word: Ensure the field contains a specific word. In this case, the user's input needs to include the word "Sheetgo".
[regex: Sheetgo]
Email: Ensure the field contains an email address. You can even specify a certain domain.
[regex: @.*com]
Quantity: Ensure the field contains only numbers.
[regex: [0-9]$]
Website: Ensure the field contains a website address.
[regex: w{3}]
Linkedin Profile: Ensure the field contains a LinkedIn profile URL.
[regex: linkedin.com]
Starting word: Ensure the field starts with a specific word.
[regex: ^hello]
Ending word: Ensure the field ends with a specific word.
[regex: bye$]
Regex metacharacters
There are endless use cases for [regex:]
. The validation is built differently for each case. Inside the [regex:]
configuration, you can use metacharacters to build strings patterns that user input must match to be valid.
These are some common regular expression metacharacters:
| | Creates an OR clause, where the field needs to include one of the available answers. Example: |
( ) | Groups expressions together, allowing you to apply quantifiers to entire sub-patterns. Example: |
? | Indicates zero or one occurrence of the preceding element. Example: |
* | Matches zero or more occurrences of the preceding element. Example: |
+ | Matches one or more occurrences of the preceding element. Example: |
{n} | The preceding item is matched exactly n times. |
{min,} | The preceding item is matched min or more times. |
{,max} | The preceding item is matched up to max times. |
{min,max} | The preceding item is matched at least min times, but not more than max times. |
. | Matches any character except a newline. Example: a.b matches any string containing "a", followed by any character, then "b". |
[ ] | Defines a character class, matching any single character within the brackets. Example: |
[^] | Defines a negated character class, matching any single character not within the brackets. Example: |
^ | Matches the start of a line or string. |
$ | Matches the end of a line or string. |
Need more help?
Contact us via chat, on our email ([email protected]), or send us a ticket!
Visit our Community for help, tips, tricks, and feedback for Sheetgo.