You can use three types of match logic in creating your rules and rule sets for segments. These match logic types are:
- All returns profiles that match all rules or rule sets.
- Any returns profiles that match any of the rules or rule sets.
- Advanced allows you to customize your rules and rule sets, by mixing and pairing rules and rule sets.

Learn more about this topic:
- Match Logic for Rules and Rule Sets
- Match Logic for Rules
- Advanced Match Logic for Rules Example
- Match Logic for Rule Sets
- Advanced Logic Errors
- Rules
- Rule Sets
There are some match logic rules that must be adhered to for both rules and rule sets.
- All and Any allows any number of rules.
- Advanced match logic allows up to 26 rules to be included.
- Rules are always referred to in letter format (i.e. A, B, C).
| Match logic type | Description | Max. Rules |
|---|---|---|
| all | includes profiles that match all rules | No limit |
| any | includes profiles that match any rules | No limit |
| advanced | includes profiles that match custom logic i.e. (A and B) or (C and D) | Max. 26 |
If you use match logic ANY with Behavior Activation, see Match Logic ANY Example with NULL value.

- All and Any allows any number of rule sets.
- Advanced match logic allows up to 9 rule sets to be included.
- Rule sets are always referred to in number format (i.e. 1, 2, 3)
| Match logic type | Description | Max. Rule Sets |
|---|---|---|
| all | includes profiles that match all rule sets | No limit |
| any | includes profiles that match any rule sets | No limit |
| advanced | includes profiles that match custom logic i.e. (1 and 2) or (3 and 4) | Max. 9 |

Advanced logic customization can result in logic errors if the match logic for rules and rule sets are not followed.
| Error Message Displayed | Error Example | Match logic error |
|---|---|---|
| Error 1: Too few rules referenced | ||
| A and B | ||
| (but there are rules A, B, and C) | There are 3 rules but only 2 are referenced. | |
| Error 2: Referenced rule does not exist | (1 and 2) and 3 | |
| Rules are supposed to be in letter format. | ||
| Error 3: Invalid format |
- A and (B or C
- A)and (B
- 1 and 2 and 3
- Weirdsyntax23
- One and two or three
| Format is incorrect.
Error 4: Max rules for advanced logic is 26 (to letter Z) Learn more| A and B and … and Z and AA| There are 27 rules, but the max allowed is 26 for advanced logic.
| Error Message Displayed | Error Example | Match logic error |
|---|---|---|
| Error 1: Too few rule sets referenced | 1 and 2 | |
| (but there are rule sets 1, 2, and 3) | There are 3 rule sets but only 2 are referenced. | |
| Error 2: Referenced rule sets does not exist | (1 and 2) or (3 and 4)(but there are rule sets 1, 2, and 3) | Rule set 4 doesn't exist |
| Error 2: Referenced rule set does not exist | (A and B) or C | |
| Supposed to be numbers in rule sets | Rule sets are supposed to be in number format. | |
| Error 3: Invalid format Learn more |
- 1 and (2 or 3
- 1 )and (2
- -1 and 2 and 3
- Weirdsyntax23
- One and two or three
| Format is incorrect.
Error 4: Max rule sets for advanced logic is 9| 1 and 2 and 3 and 4 and 5 and … and 9 and 10| There are 10 rules, but the max allowed is 9 for advanced logic.