With Eventdrive, you can simplify your data collection by adding REGEX rules to your registration forms.
Why use REGEX in Registration Forms?
How to Implement REGEX in Eventdrive
What is a REGEX?
REGEX (Regular Expressions) are rules regarding strings of characters.
They can be used to predefine the format of any type of response, for example:
- Phone number: XX.XX.XX.XX.XX
- Postal code: XXXXX
- Email address: XXXXX@XXXX.com
- IP address: XXX.XXX.XXX.XXX
Why use the REGEX function in my registration form?
REGEX is used to format responses according to a given rule.
For example, when asking for the phone number of your attendees, you might receive responses like:
- XX.XX.XX.XX.XX
- XXXXXXXXXX
- +XX XXXXXXXXX
- XX-XX-XX-XX-XX
This can slow down data processing in your spreadsheets. With the REGEX function, you can specify the formatting rule you want, for example:
^\d{2}\.\d{2}\.\d{2}\.\d{2}\.\d{2}$
This REGEX formula only accepts the completion of an XX.XX.XX.XX.XX telephone number.
Explanation of the regex:
-
^
: Indicates the beginning of the string. -
\d{2}
: Represents exactly two digits. -
.
: Represents the period character (the period must be escaped with\
because it has a special meaning in regex). -
$
: Indicates the end of the string.
All your attendees will then be required to use this format to complete their form.
How to implement it?
Go to the edit mode of your registration form (Invite -> Registration Form) and then select one of the custom fields below to activate a Regex.
In this example, attendees will be required to follow the XX.XX.XX.XX.XX format.
Examples
JAvascript Regex model | Description | Error message |
mi.....ft |
contains a nine-character (sub)string beginning with mi and ending with ft (Note: depending on context, the dot stands either for “any character at all” or “any character except a newline”.) Each dot is allowed to match a different character, so both microsoft and minecraft will match. | Answer should start with mi and finish with ft, with 5 characters in between. |
^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-](19?[0-9][0-9]|2?[0-9][0-9][0-9])$ |
Date format Accept DD/MM/YYYY and DD-MM-YYYY with : 01≤DD≤31 01≤MM≤12 1900≤YYYY≤2999 | Date format should be DD/MM/YYYY or DD-MM-YYYY |
/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$ |
IP adress format | Error, IP Address format should be xxx.xxx.xxx.xxx with 0 ≤ xxx ≤ 255 |
/^(\+\d{1,3}\s?)?\d{1,4}[\s-]?\d{1,4}[\s-]?\d{1,9}$/ |
Phone number format : (\+\d{1,3}\s?)? is an optional group for the country code, which starts with a plus sign (+) followed by 1 to 3 digits and an optional whitespace character. The ? makes this group optional. \d{1,4} matches 1 to 4 digits for the area code. [\s-]? matches an optional whitespace or hyphen between parts of the phone number. The pattern \d{1,9} matches 1 to 9 digits for the local number. "+1 555-123-4567"; // Valid "555-1234"; // Valid "123-456-7890"; // Valid "+123 45 678 9012"; // Valid "1234"; // Valid "+12345 6789"; // Valid | Phone number should be +NNN NNNNNNNNNN with 0 ≤ N ≤ 9 (country code followed by 10 digits) |
^(0[0-9]|1[0-9]|2[0-4]):([0-5][0-9]) (AM|PM)$ |
More detailled “Time” field that allow users to insert a time as international format Allows to : - Enter numbers between 00 and 24 instead of the XX - Enter numbers between 00 and 59 instead of YY - Write AM or PM instead of ZZ The format is : XX:YY ZZ The imput in the field should be a time format, here are sole valid examples : 01:45 AM 05:32 PM |
Useful Sites for Using Regex
Some AIs are capable of generating REGEX codes tailored to your needs.
Be careful, however, to check the formulas produced. A site such as https://regexr.com/ will be useful for testing them.