问题
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, ~'&.*;', '_');
回答1:
There is a replace function in cypher, but it does not replace regexps, just simple strings.
Maybe a feature request for replaceRegex
could be done?
An workaround would be to do this programatically, after you return the names (if you use call cypher queries from another application).
来源:https://stackoverflow.com/questions/27816668/replace-regular-expressions-in-cypher