apoc.text.replace

Function APOC Core

apoc.text.replace(text, regex, replacement) - replace each substring of the given string that matches the given regular expression with the given replacement.

Signature

apoc.text.replace(text :: STRING?, regex :: STRING?, replacement :: STRING?) :: (STRING?)

Input parameters

Name Type Default

text

STRING?

null

regex

STRING?

null

replacement

STRING?

null

Usage Examples

RETURN apoc.text.replace('Hello World!', '[^a-zA-Z]', '') AS output;
Table 1. Results
output

"HelloWorld"

RETURN apoc.text.replace('GDS is a Neo4j Product', 'GDS', 'Bloom') AS output;
Table 2. Results
output

"Bloom is a Neo4j Product"