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

URL: https://goingstellar.ro/reference/cql/does-not-contain-operator/

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

- `field` (optional: yes): A text field, usually title or text.
- `value` (optional: yes): A word, a word with a trailing wildcard (*), or an escaped-quote phrase.

## 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 2026-11-29.

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

Drops pages whose body talks about templates from a content review. Run on Confluence Cloud on 2026-11-29.

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

Hides the template pages when you audit a space. Run on Confluence Cloud on 2026-11-29.

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

Shows the pages under the handbook that are not runbooks. Run on Confluence Cloud on 2026-11-29.

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

Excludes pages that contain one exact phrase. Run on Confluence Cloud on 2026-11-29.

## 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.

## Related

- [~](https://goingstellar.ro/reference/cql/contains-operator/)
- [Text search](https://goingstellar.ro/reference/cql/text-search-syntax/)
- [!=](https://goingstellar.ro/reference/cql/not-equals-operator/)
- [NOT](https://goingstellar.ro/reference/cql/not-keyword/)
- [title](https://goingstellar.ro/reference/cql/title-field/)
- [text](https://goingstellar.ro/reference/cql/text-field/)

## Sources

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

