# Text search syntax in CQL: phrases, wildcards, fuzzy

URL: https://goingstellar.ro/reference/cql/text-search-syntax/

The contains operator (~) takes a search string, not just a value. Inside that string you can use phrases, wildcards, fuzzy matching and a few more operators. The Atlassian page covers phrases, wildcards and fuzzy searches; the rest below was found by running queries.

## Syntax

```
text ~ "word1 word2"
text ~ "\"exact phrase\""
title ~ "te?t"  or  title ~ "win*"
title ~ "roam~"
```

## Arguments

- `Single term` (optional: no): One word. Several words in one string must all appear, in any order.
- `Phrase` (optional: no): Words wrapped in escaped double quotes inside the string. They must appear together in that order.
- `? and *` (optional: no): ? replaces one character, * replaces zero or more.
- `~ after a word` (optional: no): Fuzzy match: finds words with a similar spelling.

## Works with

- Fields: text, title and the other text fields that accept ~ (see the contains operator).
- Operators: only ~ and !~ take a search string.
- Not with: a * or ? as the first character of a term, which the documentation says is not allowed.

## Examples

```
text ~ "incident response"
```

Single terms: pages that contain both words in any order, such as runbooks and policies that mention an incident process. Run on Confluence Cloud on 2026-11-29.

```
text ~ "\"incident response\""
```

A phrase: only pages that contain the two words next to each other in that order. Run on Confluence Cloud on 2026-11-29.

```
title ~ "run*"
```

A multiple-character wildcard: titles with a word that starts with run, such as runbook. Run on Confluence Cloud on 2026-11-29.

```
title ~ "chec?out"
```

A single-character wildcard: one unknown letter in the middle of a word. Run on Confluence Cloud on 2026-11-29.

```
title ~ "chekout~"
```

Fuzzy search: finds the title that contains checkout although the word is misspelled. Run on Confluence Cloud on 2026-11-29.

```
title ~ "\"checkout notes\"~2"
```

Proximity: the two words may be up to two words apart. This is not on the Atlassian page, but it runs. Run on Confluence Cloud on 2026-11-29.

```
title ~ "runbook -onboarding" AND space = SD
```

Exclude a term with a minus sign and combine the search with another field. Run on Confluence Cloud on 2026-11-29.

## Pitfalls

- Without escaped quotes the words are matched separately. `title ~ "company handbook"` and `title ~ "handbook company"` find the same page, but `title ~ "\"handbook company\""` finds nothing (checked on Confluence Cloud, November 2026). Use the escaped form when the order matters.
- A leading wildcard does not error, it just finds nothing. `title ~ "*ncident"` and `title ~ "?ncident"` run and match no pages, while `title ~ "incid*"` finds the Incident page. Put the fixed letters first.
- Fuzzy matching needs the tilde. `title ~ "handbok"` finds nothing, `title ~ "handbok~"` finds the handbook page. A tilde followed by a number after a quoted phrase is a proximity search, not a fuzzy one.
- A boost such as `title ~ "handbook^2"` is not supported: the query runs and matches nothing, even when the word exists. A hyphen inside the string is an operator too, so `title ~ "Template - Meeting notes"` finds nothing until it is written as `"Template \\- Meeting notes"` (checked on Confluence Cloud, November 2026).

## Questions and answers

### Is ~ case sensitive in CQL?

No. `title ~ "RUNBOOK"` finds the same pages as `title ~ "runbook"`. Word endings are also handled: `title ~ "Runbooks"` finds runbook titles (checked on Confluence Cloud, November 2026).

## Related

- [~](https://goingstellar.ro/reference/cql/contains-operator/)
- [!~](https://goingstellar.ro/reference/cql/does-not-contain-operator/)
- [text](https://goingstellar.ro/reference/cql/text-field/)
- [title](https://goingstellar.ro/reference/cql/title-field/)
- [Reserved characters and words](https://goingstellar.ro/reference/cql/reserved-words/)
- [AND](https://goingstellar.ro/reference/cql/and-keyword/)

## Sources

- [Performing text searches using CQL (Atlassian Developer, Confluence Cloud)](https://developer.atlassian.com/cloud/confluence/performing-text-searches-using-cql/)
- [CQL operators (Atlassian Developer, Confluence Cloud)](https://developer.atlassian.com/cloud/confluence/cql-operators/)

