Match Types
A match type is how CROForge compares two values. Everyday meaning: the verb in a rule — “equals,” “contains,” “is greater than,” “looks like this pattern.” In the product this is the MATCH_TYPE enum (numbers 0 through 20). The UI shows friendly labels; the runtime stores the number.
Which operators you see depends on the field’s data type (Text, Number, Boolean, URL). Maps live in condition-field-config.ts (TEXT_MATCH_TYPES, NUMBER_MATCH_TYPES, and similar).
Words used on this page
| Word | Everyday meaning | Meaning in CROForge |
|---|---|---|
| Match type | How to compare | A MATCH_TYPE value from 0 (Exact match) through 20 (URL match) |
| Exact match | The whole value is the same | Enum 0 — equals. For URLs, the cleaned origin + pathname must be identical |
| Does not match | It is not the same | Enum 1 — not equals |
| Contains | This text appears somewhere inside | Enum 2 — substring |
| Does not contain | This text is not inside | Enum 3 |
| Starts with | It begins with this text | Enum 4 — prefix. Useful for “whole site from this origin” |
| Does not start with | It does not begin with this text | Enum 5 |
| Ends with | It finishes with this text | Enum 6 — suffix |
| Does not end with | It does not finish with this text | Enum 7 |
| Regex / Match regex | A pattern language for text | Enum 8 — RegExp test. Mistakes fail closed (no match) |
| Does not match regex | The pattern does not fit | Enum 9 — inverse regex |
| Include vs exclude | Allow vs block | Not a match type; a flag on URL rules. URL match (20) evaluates a pack of include/exclude rules |
| OR within a list | Any one value is enough | Text conditions often accept a JSON array of strings; any item may match |
| Between | Inside a numeric range | Enum 18 — range like 100,200 or structured [from, to] |
| URL match | Check a list of page rules | Enum 20 — evaluate a pack of URL include/exclude rules |
| Data type | Kind of value | Text shows string operators; Number shows numeric operators; Boolean is true/false; URL uses URL match |
| Condition | A rule | Match type plus value, used in segments, metrics, and experiment pages |
Screenshot
Use this screenshot filename when you add a capture: match-type-select.png in docs/assets/placeholders/. Do not embed an image in this file.
Enum reference (MATCH_TYPE)
Text / URL string operators
These apply to text attributes and to each individual URL pattern inside a URL-rule pack. Labels in the UI are lowercase with spaces (for example “exact match”).
| Name | Value | Meaning |
|---|---|---|
| Exact match | 0 | Equals |
| Does not match | 1 | Not equals |
| Contains | 2 | Substring |
| Does not contain | 3 | No substring |
| Starts with | 4 | Prefix |
| Does not start with | 5 | Not prefix |
| Ends with | 6 | Suffix |
| Does not end with | 7 | Not suffix |
| Match regex | 8 | RegExp test |
| Does not match regex | 9 | Inverse RegExp |
Text conditions often accept a JSON array of strings. Match if any item matches (OR within the list). Keep list values consistent with attribute casing from Smart Code (for example DESKTOP vs desktop).
Boolean
Boolean means yes/no. There is no extra typed value — the match type is the value.
| Name | Value | Meaning |
|---|---|---|
| Is true | 10 | The attribute or property is true |
| Is false | 11 | The attribute or property is false |
Number
| Name | Value | Meaning |
|---|---|---|
| Equal to | 12 | Same number |
| Not equal to | 13 | Different number |
| Greater than | 14 | Strictly larger |
| Less than | 15 | Strictly smaller |
| ≥ (greater than or equal to) | 16 | At least this number |
| ≤ (less than or equal to) | 17 | At most this number |
| Between | 18 | Inside a range |
| Not between | 19 | Outside that range |
Between uses a range like 100,200 or structured [from, to] depending on serializer version. Confirm which form your workspace API stores before you edit values by hand.
Special
| Name | Value | Meaning |
|---|---|---|
| URL match | 20 | Evaluate a pack of URL include/exclude rules (not a single string compare) |
When the data type is URL, the operator list is typically just URL match. The include/exclude rows inside that pack still use Exact / Contains / Starts with / Regex (0–9) against each pattern.
Which operators show in the UI
Driven by data type maps in condition-field-config.ts:
- Text → string operators 0–9.
- Number → numeric operators 12–19.
- Boolean → is true / is false (10–11).
- URL → URL match (20), whose inner rules use the URL string operators.
Tips
- Prefer Exact or Starts with over Regex when possible — easier to QA and less likely to fail closed from a typo.
- Regex mistakes fail closed (no match) in runtime. A broken pattern will not “match everything.”
- Keep list values consistent with attribute casing produced by Smart Code.
- For pages, remember runtime compares origin + pathname (query and hash stripped). Exact match on a URL that still has
?utm=in the pattern will not match the cleaned page.