# Operators (/docs/reference/operators)

Every comparison operator, the types it accepts and when it holds.



A comparison is `{ "field": <path>, "operator": <operator>, "value": <value> }`. Types are checked when the rule loads.

| Operator             | Field type       | Value                                     | Holds when                                   |
| :------------------- | :--------------- | :---------------------------------------- | :------------------------------------------- |
| `equals`             | any              | same type as the field                    | the values are equal                         |
| `notEquals`          | any              | same type as the field                    | the values differ                            |
| `greaterThan`        | number           | number                                    | `field > value`                              |
| `greaterThanOrEqual` | number           | number                                    | `field ≥ value`                              |
| `lessThan`           | number           | number                                    | `field < value`                              |
| `lessThanOrEqual`    | number           | number                                    | `field ≤ value`                              |
| `between`            | number           | `[min, max]`                              | `min ≤ field ≤ max`, bounds included         |
| `in`                 | number or string | a list, or a list option                  | the field is one of the list                 |
| `notIn`              | number or string | a list, or a list option                  | the field is none of the list                |
| `contains`           | string           | string                                    | the field contains the value, case-sensitive |
| `notContains`        | string           | string                                    | the field does not contain the value         |
| `matches`            | string           | a regular expression, as a literal string | the pattern matches somewhere in the field   |
| `exists`             | any              | none                                      | the field is known                           |
| `notExists`          | any              | none                                      | the field is unknown                         |

Every operator except `exists` and `notExists` is **false when the field or the value is unknown**. See [Unknown values](/docs/guides/conditions#unknown-values).

## Values [#values]

* A **literal**: `120`, `"video"`, `true`, a list `["mov", "mxf"]` for `in` / `notIn`, a pair `[50, 150]` for `between`.
* A **field reference**: `{ "field": "options.max" }` or `{ "field": "sequence.inPoint" }`, compared with the field's value for the same item.
* **Infinity**: JSON has none; write the strings `"Infinity"` and `"-Infinity"` where a number is expected.

## Regular expressions [#regular-expressions]

`matches` takes a [JavaScript regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions) with the `u` flag, as a literal string; it cannot refer to a field. It matches anywhere in the value: anchor it with `^` and `$` to match the whole value. Backslashes are doubled in JSON: `"^Chapter \\d+$"`.
