Boost recurring donations this giving season with the new upsell prompt!Learn How >>

Creating regular expression (REGEX) custom validation rules for Event registration fields

updated

A regular expression - or REGEX, for short - is an extremely flexible syntax that allows you to define a specific pattern for a string. These can be applied to standard or custom registration fields in the Contact Information or Attendee Information forms sections of an Event registration to limit the values that can be input into a field.

Here are some common examples of regex for form field validations as created by ChatGPT which can be a helpful resource for creating REGEX based on a human language prompt that you give it.

1. Email

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

This regex checks if the input is a valid email address by matching a pattern that consists of a username part, followed by the @ symbol, a domain name, and a top-level domain name. It allows letters, numbers, and certain special characters in the username and domain name, and requires at least two letters in the top-level domain name.

2. Phone number

^\+?\d{1,3}[- ]?\d{3,4}[- ]?\d{4}$

This regex checks if the input is a valid phone number, with or without a country code prefix (+). It allows digits and optional spaces or hyphens between the groups of digits.

3. URL

^(https?:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$

This regex checks if the input is a valid URL that starts with optional HTTP or HTTPS protocol, followed by a domain name, and optional port number and path. It allows lowercase letters, digits, and hyphens in the domain name, and supports subdomains and query strings.

For more details on using REGEX in the Events app, check out these articles:

Have more questions? Submit a request
Article is closed for comments.