# Advanced Operators

## CLQL Advanced Operators

CLQL supports basic operators (`=`, `!=`, `<`, `<=`, `>`, `>=`, `<>`, `in`, `not`, `not in`).

Below are some **advanced** operators:

### `matches`

Use a regex-like pattern on a string property.

```graphql
# Match 'aba', 'abb', 'abz', etc.
_message matches ab.

# Match 'ab' and 'abc'
_message matches abc?

# Match 'ab', 'abb', 'abbb', etc.
_message matches ab+

# Match 'a', 'ab', 'abb', 'abbb', etc.
_message matches ab*

# Match 'aa', 'aaa', and 'aaaa'
_message matches a{2,4}

# Match 'abc' or 'xyz'
_message matches abc|xyz

# Match 'abc' or 'abcdef' but not 'abcd'
_message matches abc(def)?

# Match 'a', 'b', 'c'
_message matches [abc]

# Match 'adc' and 'aec' but not 'abc'
_message matches a~bc

# Match 'abc' but nothing else
_message matches #|abc

# Match 'foo1', 'foo2', ..., 'foo100'
_message matches foo<1-100>

# Match 'aaabbbccc'
_message matches aaa.+&.+ccc

# Match everything not beginning with 'abc'
_message matches @&~(abc.+)
```

### `where`

Filter search results conditionally.

* Must start on a new line
* Must be preceded by `|`

```graphql
| where _instance matches http*
```

### `exists`

Check if a value exists for a specified field.

```graphql
| where _name exists
```

### `sort by`

Order search results by a specified field.

* Must start on a new line
* Must be preceded by `|`
* Default order is `desc` (descending)

```graphql
| sort by _createdAt asc
```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.contextual.io/documentation-and-resources/tenants/tenant-logs/contextual-log-query-language-clql/advanced-operators.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
