Skip to content

Targeting Operators

Targeting operators are used in flag targeting rule conditions and segment conditions. Each condition compares a context property against a value using an operator.

String operators

equals

Exact equality match.

{ "property": "plan", "operator": "equals", "value": "premium" }

Matches when context.plan === "premium".

not_equals

Matches when the values are not equal.

{ "property": "plan", "operator": "not_equals", "value": "free" }

contains

String containment check. Both values must be strings.

{ "property": "email", "operator": "contains", "value": "@acme.com" }

Matches when context.email includes "@acme.com".

not_contains

Matches when the context value does not contain the condition value.

{ "property": "email", "operator": "not_contains", "value": "@competitor.com" }

starts_with

String prefix check.

{ "property": "user_id", "operator": "starts_with", "value": "usr_" }

ends_with

String suffix check.

{ "property": "email", "operator": "ends_with", "value": "@company.com" }

List operators

in

Checks if the context value is in the provided array.

{ "property": "plan", "operator": "in", "value": ["premium", "enterprise"] }

Matches when context.plan is either "premium" or "enterprise".

not_in

Matches when the context value is not in the array.

{ "property": "country", "operator": "not_in", "value": ["CN", "RU"] }

Numeric operators

All numeric operators convert both values to numbers. Returns false if either value is not a valid number.

gt

Greater than.

{ "property": "login_count", "operator": "gt", "value": 100 }

gte

Greater than or equal.

{ "property": "age", "operator": "gte", "value": 18 }

lt

Less than.

{ "property": "error_rate", "operator": "lt", "value": 0.05 }

lte

Less than or equal.

{ "property": "plan_tier", "operator": "lte", "value": 3 }

Pattern operator

regex

Regular expression match. The condition value is the regex pattern.

{ "property": "email", "operator": "regex", "value": "^[a-z]+@(acme|globex)\\.com$" }

Safety restrictions:

  • Maximum pattern length: 200 characters
  • Nested quantifiers are rejected (e.g., (a+)+)
  • Overlapping alternation with quantifiers is rejected

Patterns that fail safety checks or are invalid regex will not match.

Existence operators

exists

Matches when the context property is present and not null.

{ "property": "phone", "operator": "exists", "value": true }

The value field is ignored for this operator.

not_exists

Matches when the context property is undefined or null.

{ "property": "deleted_at", "operator": "not_exists", "value": true }

Date operators

Date operators parse both values as dates. Returns false if either value is not a valid date.

before

Matches when the context date is before the condition date.

{ "property": "created_at", "operator": "before", "value": "2026-01-01T00:00:00Z" }

after

Matches when the context date is after the condition date.

{ "property": "trial_end", "operator": "after", "value": "2026-06-01T00:00:00Z" }

Segment operators

When property is "segment", the in and not_in operators check segment membership instead of direct value comparison.

Segment in

{ "property": "segment", "operator": "in", "value": ["beta_users", "premium_users"] }

Matches if the user is in ANY of the listed segments (OR logic). Each segment’s conditions are evaluated against the user context.

Segment not_in

{ "property": "segment", "operator": "not_in", "value": ["blocked_users"] }

Matches if the user is not in ANY of the listed segments.

See Segments for more on defining and using segments.

Combining conditions

Within a single rule, conditions use AND logic — all conditions must match:

{
"conditions": [
{ "property": "plan", "operator": "equals", "value": "premium" },
{ "property": "country", "operator": "in", "value": ["US", "CA"] }
],
"value": true
}

This rule matches users who are on the premium plan AND in the US or Canada.

Between rules, OR logic applies — the first matching rule wins.