Replace regular expressions in cypher

谁都会走 提交于 2019-12-07 05:32:12

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!