# Text match operator (\~)

Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fdataprime%2Flanguage-reference%2Ftext_match_operator.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fdataprime%2Flanguage-reference%2Ftext_match_operator.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

The `~` operator checks whether a specified field matches a free-text pattern. It's the underlying mechanism behind the [`find` / `text`](https://coralogix.com/docs/dataprime/language-reference/commands-reference/find_text.md) command, which is a shorthand for combining `filter` with a `~` text match.

## Syntax[​](#syntax "Direct link to Syntax")

```
<keypath> ~ '<text>'
```

## Field-specific vs. all-fields matching[​](#field-specific-vs-all-fields-matching "Direct link to Field-specific vs. all-fields matching")

Use `~` when you know which field holds the value you're searching for:

```
source logs

| filter msg ~ 'eu-west-1a'
```

This is equivalent to:

```
source logs

| find 'eu-west-1a' in msg
```

When you don't know which field contains the value, use the all-fields variant `~~` (also available as the [`wildfind` / `wildtext`](https://coralogix.com/docs/dataprime/language-reference/commands-reference/wildfind_wildtext.md) command) instead:

```
source logs

| filter $d ~~ 'eu-west-1a'
```

`~~` is significantly slower than `~`, since it must inspect every root-level field of every document. Prefer `~` whenever the keypath is known.

## Combining with other filters[​](#combining-with-other-filters "Direct link to Combining with other filters")

`~` can be combined with additional `filter` stages, like any other boolean expression:

```
source logs

| filter msg ~ 'timeout'

| filter $m.severity == 'Error'
```

## `~` vs. `contains()`[​](#-vs-contains "Direct link to -vs-contains")

`~` performs a text match, not a strict substring check. For case-sensitive substring containment, use [`contains()`](https://coralogix.com/docs/dataprime/language-reference/functions-reference/string/contains.md) instead — see [`case_contains`](https://coralogix.com/docs/dataprime/language-reference/functions-reference/cases/case_contains.md) and [`case_find`](https://coralogix.com/docs/dataprime/language-reference/functions-reference/cases/case_find.md) for the equivalents inside `case` expressions.

## See also[​](#see-also "Direct link to See also")

* [`find` / `text`](https://coralogix.com/docs/dataprime/language-reference/commands-reference/find_text.md)
* [`wildfind` / `wildtext`](https://coralogix.com/docs/dataprime/language-reference/commands-reference/wildfind_wildtext.md)
* [Fuzzy search all fields](https://coralogix.com/docs/dataprime/cookbook/fuzzy_search_all_fields.md)
