---
title: replace
url: https://nexyron.tech/docs/cypher/functions/string/replace
description: Replaces every occurrence of a substring with another string. It is documented separately because text normalization and slicing often become grouping keys, search inputs, or expor
---

# replace

## Generic Description

Replaces every occurrence of a substring with another string. It is documented separately because text normalization and slicing often become grouping keys, search inputs, or exported identifiers.

Simple example:

```cypher
RETURN replace('incident review', ' ', '_') AS normalized
```

## Consumer-Level Explanation

Use it for explicit, visible cleanup of identifiers, titles, and labels before grouping or export. Prefer this function when the text operation is part of the query contract and should be visible during review.

## More Detailed Explanation

`replace` runs inside the row pipeline, which makes text cleanup, extraction, and grouping keys visible to Nexyron instead of hidden in application code. That is especially important for imported document metadata, labels, and identifiers that feed later matching or indexing.

## Advanced Example

This example applies `replace` while shaping document metadata, so text cleanup is part of the auditable query rather than an application-side afterthought.

```cypher
MATCH (d:Document)
WITH d, replace(lower(d.title), ' ', '_') AS normalized_title
RETURN d.title AS original_title, normalized_title
ORDER BY normalized_title
```

## Real Use Cases

-   normalizing document titles and source identifiers before grouping
-   extracting prefixes, suffixes, or tokens from imported text fields
-   checking payload size or Unicode normalization before ingestion cleanup

## Real Limitations And Tradeoffs

-   query-time cleanup is explicit but can hide upstream data-quality debt if overused
-   string operations are not semantic search; use vector or semantic procedures for meaning-based matching
-   byte length and character length answer different questions and should not be substituted blindly
