替换密码中的正则表达式 [英] Replace regular expressions in cypher

查看:24
本文介绍了替换密码中的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在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, ~'&.*;', '_');

推荐答案

有一个 replace 函数在 cypher 中,但它不替换正则表达式,只是简单的字符串.也许可以完成对 replaceRegex 的功能请求?

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).

这篇关于替换密码中的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆