Replace regular expressions in cypher
I can search for regular expressions in cypher
MATCH (n:model) WHERE n.name =~ '.*&.*;.*' RETURN n.name
but can i also replace them? I would like to write something like
MATCH (n:model) RETURN replace(n.name, ~'&.*;', '_');
+3
Dirk horsten
source
to share
1 answer
Cypher has a replace function , but it doesn't replace regular expressions, just plain strings. Maybe a feature request for replaceRegex
can be fulfilled?
A workaround would be to do this programmatically, after you return the names (if you are using cypher calls from another application).
+2
zaboco
source
to share