Important Note: You may require help from your developer to use Regex. πββοΈ
You can create rules that people have to follow when they fill out your form.
For example, if you ask for EIN, you can make sure that people can only submit properly formatted data - if the format is wrong, they'll see an error message.
In order to accomplish that, you can use Regular expressions (Regex) in your Clustdoc forms.
Adding a Regex
- Head over to your Clustdoc form whether it's in a process, a live application or saved in the Toolbox
- Scroll to the field where you want to add Regular expressions
- Select the Regex type of field
- Add the regular expression into the related field
- Add a Help Text that will be displayed in Red if the format is Invalid
A few examples
Example of placeholder | Regex to add to form field | |
Social Security Number SSN | 123-45-6789 | ^\d{3}-?\d{2}-?\d{4}$ |
Employer Identification Number EIN | 12-1234567 | ^[1-9]\d?-\d{7}$ |
5 digits Zip Code | 10001 | ^\d{5}$ |
10 digits Phone Number | 5555555555 | ^\d{10}$ |
Last 4 digits SSN | 1234 | ^\d{4}$ |
Regex Cheat Sheet
π‘ Easy way to generate a Regex : https://www.autoregex.xyz/
Character | Meaning | Example |
---|---|---|
* | Match zero, one or more of the previous | Ah* matches "Ahhhhh " or "A " |
? | Match zero or one of the previous | Ah? matches "Al " or "Ah " |
+ | Match one or more of the previous | Ah+ matches "Ah " or "Ahhh " but not "A " |
\ | Used to escape a special character | Hungry\? matches "Hungry? " |
. | Wildcard character, matches any character | do.* matches "dog ", "door ", "dot ", etc. |
( ) | Group characters | See example for | |
[ ] | Matches a range of characters | [cbf]ar matches "car", "bar", or "far"[0-9]+ matches any positive integer[a-zA-Z] matches ascii letters a-z (uppercase and lower case)[^0-9] matches any character not 0-9. |
| | Matches previous OR next character/group | (Mon|Tues)day matches "Monday" or "Tuesday" |
{ } | Matches a specified number of occurrences of the previous | [0-9]{3} matches "315" but not "31"[0-9]{2,4} matches "12", "123", and "1234"[0-9]{2,} matches "1234567..." |
^ | Beginning of a string. Or within a character range [] negation. |
^http matches strings that begin with http, such as a url.[^0-9] matches any character not 0-9. |
$ | End of a string. | ing$ matches "exciting" but not "ingenious" |
Comments
0 comments
Please sign in to leave a comment.