Going Stellar

Home/CQL reference

CQL operator

!~ (DOES NOT CONTAIN) operator in CQL for Confluence

The !~ operator is the negative of ~. It keeps content where the text field does not match the words you give. Use it to filter out templates, drafts or a topic from a result you already narrowed with other clauses.

Syntax

field !~ word
field !~ "word*"

Arguments

ArgumentWhat it doesOptional
fieldA text field, usually title or text.yes
valueA word, a word with a trailing wildcard (*), or an escaped-quote phrase.yes

Works with

  • Operators: !~ is for text fields: title and text. It also runs on space, where it works on the space name.
  • Functions: none.
  • Not with: id, date and fixed-value fields such as created, type and label. Use != or NOT IN there.

Examples

title !~ "run*" and type = page and space = SD

Lists the pages of a space that are not runbooks, whatever the runbook title looks like.

Run on Confluence Cloud on .

text !~ "template" and type = page and space = SD

Drops pages whose body talks about templates from a content review.

Run on Confluence Cloud on .

type = page and space = SD and title !~ "template*"

Hides the template pages when you audit a space.

Run on Confluence Cloud on .

title !~ "runbook" and type = page and ancestor = 32964613

Shows the pages under the handbook that are not runbooks.

Run on Confluence Cloud on .

text !~ "\"design notes\"" and space = SD and type = page

Excludes pages that contain one exact phrase.

Run on Confluence Cloud on .

Pitfalls

  • The documentation example space = DEV and title !~ run excludes nothing you would expect. A bare word matches whole words only, so title ~ run finds no "Runbook" and !~ run keeps it. Use !~ "run*" (checked on Confluence Cloud, November 2026).
  • !~ is a filter on one side only. Alone it matches almost everything, so it needs a positive clause such as a space or a type next to it.
  • The documentation says !~ does not work on space. space !~ "Software" runs and filters on the space name (checked on Confluence Cloud, November 2026).
  • A phrase needs escaped quotes, as with ~. The exact text-search rules are on the text search syntax page.

Sources

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

Markdown version · All CQL pages