Match Types

Documents / Conditions

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

WordEveryday meaningMeaning in CROForge
Match typeHow to compareA MATCH_TYPE value from 0 (Exact match) through 20 (URL match)
Exact matchThe whole value is the sameEnum 0 — equals. For URLs, the cleaned origin + pathname must be identical
Does not matchIt is not the sameEnum 1 — not equals
ContainsThis text appears somewhere insideEnum 2 — substring
Does not containThis text is not insideEnum 3
Starts withIt begins with this textEnum 4 — prefix. Useful for “whole site from this origin”
Does not start withIt does not begin with this textEnum 5
Ends withIt finishes with this textEnum 6 — suffix
Does not end withIt does not finish with this textEnum 7
Regex / Match regexA pattern language for textEnum 8 — RegExp test. Mistakes fail closed (no match)
Does not match regexThe pattern does not fitEnum 9 — inverse regex
Include vs excludeAllow vs blockNot a match type; a flag on URL rules. URL match (20) evaluates a pack of include/exclude rules
OR within a listAny one value is enoughText conditions often accept a JSON array of strings; any item may match
BetweenInside a numeric rangeEnum 18 — range like 100,200 or structured [from, to]
URL matchCheck a list of page rulesEnum 20 — evaluate a pack of URL include/exclude rules
Data typeKind of valueText shows string operators; Number shows numeric operators; Boolean is true/false; URL uses URL match
ConditionA ruleMatch 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”).

NameValueMeaning
Exact match0Equals
Does not match1Not equals
Contains2Substring
Does not contain3No substring
Starts with4Prefix
Does not start with5Not prefix
Ends with6Suffix
Does not end with7Not suffix
Match regex8RegExp test
Does not match regex9Inverse 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.

NameValueMeaning
Is true10The attribute or property is true
Is false11The attribute or property is false

Number

NameValueMeaning
Equal to12Same number
Not equal to13Different number
Greater than14Strictly larger
Less than15Strictly smaller
≥ (greater than or equal to)16At least this number
≤ (less than or equal to)17At most this number
Between18Inside a range
Not between19Outside 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

NameValueMeaning
URL match20Evaluate 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.

Related reading