Going Stellar

Home/CQL reference

CQL operator

~ (CONTAINS) operator in CQL for Confluence search

The ~ operator is the CQL CONTAINS operator. It matches a field against words you give it, not against an exact string. You use it to find pages by words in the title or body, with a trailing wildcard or a quoted phrase when you need more control.

Syntax

field ~ word
field ~ "word*"
field ~ "\"exact phrase\""

Arguments

ArgumentWhat it doesOptional
fieldA text field, usually title or text. Sub-fields such as creator.fullname also work.yes
valueA word, a word with a trailing wildcard (*), or a phrase wrapped in escaped double quotes inside the string.yes

Works with

  • Operators: ~ is for text fields: title, text, and sub-fields such as creator.fullname. It also runs on space, where it matches the space name.
  • Functions: none.
  • Not with: fields that take ids, dates or fixed values such as id, created, type and label. Use = or IN there.

Examples

title ~ "hand*"

Finds pages whose title has a word starting with "hand", for example a handbook.

Run on Confluence Cloud on .

text ~ "\"design notes\""

Searches the body of pages for the exact phrase, with the words next to each other and in that order.

Run on Confluence Cloud on .

title ~ "polic*" and space = SD

Lists policy pages in one space, whatever the exact title says.

Run on Confluence Cloud on .

title ~ "Remote Guidelines"

Finds a page when you remember two words from its title but not the order or the words between them.

Run on Confluence Cloud on .

text ~ "incident" and type = page and space = SD ORDER BY lastmodified DESC

Finds the pages that mention an incident, most recently changed first.

Run on Confluence Cloud on .

Pitfalls

  • A bare word is a whole-word match. title ~ "hand" does not find a title with "Handbook", while title ~ "hand*" does (checked on Confluence Cloud, November 2026). A wildcard at the start, as in "*hand", matches nothing.
  • Several words without quotes match in any order: title ~ "Remote Guidelines" finds "Remote Work Guidelines". With escaped quotes the words must appear together and in order, so title ~ "\"Work Remote\"" finds nothing.
  • The documentation says ~ does not work on space. space ~ "Software" runs and matches the space name (checked on Confluence Cloud, November 2026). space ~ "SD" finds nothing, because the key is not part of the name.
  • Inner quotes must be escaped with a backslash inside the quoted value. The rules for stemming, wildcards and special characters belong to text search in general and are covered on the text search syntax page.

Questions and answers

Is ~ case sensitive?

No. Titles written with different capitals match the same query, for example title ~ "Handbok~" and title ~ "handbok~" both find the same page.

Sources

  1. CQL operators (Atlassian Developer, Confluence Cloud)
  2. Performing text searches using CQL (Atlassian Developer, Confluence Cloud)

Markdown version · All CQL pages