Pular para o conteúdo

Operators

Atualizado em Ver como Markdown

Flagship supports 11 comparison operators for targeting rule conditions. Each operator compares an attribute from the evaluation context against a specified value.

Operator reference

Operator Description Example Value type
equals Returns true if the attribute value matches the specified value. country equals "US" String
not_equals Returns true if the attribute value does not match the specified value. plan not_equals "free" String
greater_than Returns true if the attribute value is greater than the specified value. age greater_than 18 Number, ISO 8601 datetime
less_than Returns true if the attribute value is less than the specified value. loginCount less_than 5 Number, ISO 8601 datetime
greater_than_or_equals Returns true if the attribute value is greater than or equal to the specified value. score greater_than_or_equals 90 Number, ISO 8601 datetime
less_than_or_equals Returns true if the attribute value is less than or equal to the specified value. createdAt less_than_or_equals "2025-01-01T00:00:00Z" Number, ISO 8601 datetime
contains Returns true if the attribute value contains the specified substring. email contains "@cloudflare.com" String
starts_with Returns true if the attribute value starts with the specified prefix. path starts_with "/api/v2" String
ends_with Returns true if the attribute value ends with the specified suffix. domain ends_with ".dev" String
in Returns true if the attribute value is in the specified array. country in ["US", "CA", "UK"] Array
not_in Returns true if the attribute value is not in the specified array. userId not_in ["blocked-1", "blocked-2"] Array

Operator categories

Equality operators

equals, not_equals

Use these operators for exact string matching. The comparison is case-sensitive.

Comparison operators

greater_than, less_than, greater_than_or_equals, less_than_or_equals

These operators work with numeric values and ISO 8601 datetime strings. When comparing datetimes, provide the value in ISO 8601 format (for example, "2025-01-01T00:00:00Z").

String operators

contains, starts_with, ends_with

These operators perform substring matching against the attribute value. All string comparisons are case-sensitive.

Array operators

in, not_in

The value must be an array. Flagship checks whether the attribute value is a member of the specified array.