Condition Operators and Regex for Conditional Notifications
A conditional notification compares an answer with a value that you give. This reference lists every comparison, the question types it works with and how the add-on reads each kind of answer.
The examples use a support form with the questions Topic, Order number, How urgent is it?, Products (Checkboxes) and Message.
Text Comparisons
Section titled “Text Comparisons”Text comparisons ignore capital letters and the spaces around the answer.
| Comparison | True when | Value you give | Matches | Doesn’t match |
|---|---|---|---|---|
| Equals | The whole answer is the value | Billing |
billing |
Billing question |
| Any of | The answer is one of the values | Order problem, Returns |
Returns |
Billing |
| None of | The answer is none of the values | Billing, Returns |
Order problem, an empty answer |
Billing |
| Contains | The value is somewhere in the answer | refund |
I want a refund today |
Please return my money |
| Does not contain | The value is nowhere in the answer | test |
My order is late |
This is a test |
| Is Empty | The question was skipped | An empty answer | Any answer | |
| Is Not Empty | The question was answered | Any answer | An empty answer |
For Any of and None of, type each value and press Enter, or pick the values from the list of the question’s options.
Number Comparisons
Section titled “Number Comparisons”Number comparisons work when both the answer and your value are numbers. If the answer is two or 12 boxes, the condition is false.
| Comparison | True when | Value | Matches | Doesn’t match |
|---|---|---|---|---|
| Equal to == | The answer is the same number | 5 |
5, 5.0 |
6 |
| Not equal to != | The answer is a different number | 5 |
6 |
5 |
| Greater than | The answer is above the value | 5 |
6 |
5 |
| Lesser than | The answer is below the value | 5 |
4 |
5 |
Greater than and Lesser than leave out the value itself. To match “5 or more”, use Greater than with 4.
To match a range, add two conditions on the same question and join them with AND: greater than 17 and lesser than 66 matches 18 to 65.
Comparisons by Question Type
Section titled “Comparisons by Question Type”The add-on shows only the comparisons that make sense for the question you choose.
| Question type | Comparisons offered | How the add-on reads the answer |
|---|---|---|
| Short answer, Paragraph | All | The text as typed |
| Multiple choice, Dropdown | Text comparisons and regex | The chosen option |
| Checkboxes | Text comparisons and regex | Every ticked option |
| Multiple choice grid, Checkbox grid | Text comparisons and regex | Each row with its column, as Row (Column) |
| Linear scale | Number comparisons, Is Empty, Is Not Empty, regex | The chosen number |
| Date, Time | Contains, Does not contain, Is Empty, Is Not Empty, regex | The date or time as your emails show it |
| File upload | Is Empty, Is Not Empty | Whether a file was uploaded |
Quiz Score, Quiz Score Percent |
Number comparisons | The score as a number |
Checkboxes
Section titled “Checkboxes”A Checkboxes answer can hold several options. Use Any of or Contains.
| Respondent ticks | Equals Sofa |
Any of Sofa, Bed |
Contains Sofa |
|---|---|---|---|
Sofa |
True | True | True |
Sofa and Lamp |
False | True | True |
Lamp |
False | False | False |
For a grid question, the value list offers each row, each column and each pair. With rows Delivery and Product quality and columns Good and Poor:
| Value you choose | True when |
|---|---|
Delivery (Poor) |
The respondent chose Poor in the Delivery row |
Poor |
Any row has Poor |
Delivery |
The Delivery row was answered |
Dates and Times
Section titled “Dates and Times”The add-on compares the date as text, in the format that your notifications use. With the default format, a date reads Mar 14, 2027. A Contains condition with Mar matches every date in March, and 2027 matches the whole year.
If you change the date format in Form Settings, check your date conditions. The text that they compare changes too.
Regular Expressions
Section titled “Regular Expressions”A regular expression, or regex, is a pattern that describes text. Use (RegEx) Matches and (RegEx) Does not match when the other comparisons are not enough. Regex conditions ignore capital letters.
| Pattern | Matches | Example use |
|---|---|---|
iPad|iPhone|Mac |
An answer that has any of these words | Send Apple questions to the Apple specialist |
^Tim |
An answer that starts with “Tim” | Names that start with Tim |
\.edu$ |
An answer that ends with “.edu” | Email addresses from universities |
^.{4}$ |
An answer of exactly 4 characters | A 4-letter code |
^\d{5}$ |
Exactly 5 digits | A US ZIP code |
^(9[0-9]|100)$ |
A number from 90 to 100 | Top marks in a typed score |
@(gmail|yahoo)\.com$ |
Addresses at Gmail or Yahoo | Personal email addresses |
In a pattern, ^ is the start of the answer, $ is the end, . is any character, \d is a digit and | means “or”.
Test a pattern at regex101.com before you use it. Choose the JavaScript flavour and turn on the case-insensitive flag.
Combine Conditions
Section titled “Combine Conditions”Inside one condition set, each condition after the first starts with AND or OR.
| You want | Build it as |
|---|---|
| Urgent billing requests | Topic equals Billing AND How urgent is it? equals Urgent |
| Billing or returns | Topic any of Billing, Returns |
| Billing, or anything urgent | Topic equals Billing OR How urgent is it? equals Urgent |
| Ages 18 to 65 | Age greater than 17 AND Age lesser than 66 |
The add-on reads the conditions from top to bottom, one at a time. A OR B AND C is read as (A OR B) AND C. If you need A OR (B AND C), put A in one condition set and B AND C in another, with the same Notify address.
Things to Know
Section titled “Things to Know”- A condition that is not complete is dropped when you save. Each one needs a question, a comparison and a value. Is Empty and Is Not Empty need no value.
- A pattern with a mistake, such as an open bracket with no closing bracket, makes the condition false. It doesn’t stop the other conditions.
- If Contains has a value with commas, such as
red, blue, and the whole text is not in the answer, the add-on also checks each part. An answer ofbluethen matches. - Number comparisons read the answer as a number. An answer such as
1,200or$25is not a number and gives false. Ask for plain digits in the question, with response validation.
Troubleshooting
Section titled “Troubleshooting”The comparison you want is not in the list
Section titled “The comparison you want is not in the list”The list depends on the question type. A Dropdown has no Greater than, and a File upload has only Is Empty and Is Not Empty. If you need a number comparison, change the question to Short answer with number validation, or to Linear scale.
A number condition never matches
Section titled “A number condition never matches”The answer has text around the number, such as 3 people. Number comparisons need a plain number. Add response validation to the question so that respondents can type only a number.
A regex condition doesn’t match
Section titled “A regex condition doesn’t match”- A special character needs a backslash. To match a real dot, write
\.. - The pattern has
^and$, so it must match the whole answer. Remove them to match part of the answer. - For a Checkboxes question, the answer holds every ticked option. Don’t use
^and$there.
