gpt4 book ai didi

neo4j - 换行符模式搜索?

转载 作者:行者123 更新时间:2023-12-04 16:09:14 26 4
gpt4 key购买 nike

使用一个简单的查询:

MATCH (c:Customer)
where c.customerRemark =~ '(?ui).*test.*'
RETURN c

当你有一个单行文本时,它工作得很好。当您在数据记录中插入一个新的换行符/换行符时,查询失败并且不显示数据记录,尽管单词测试在数据字段中。似乎 cypher 看不到换行符后面的内容?任何人都可以分享经验或知道如何避免这种情况?

预期结果应该是在 customerRemarks 字段中找到所有带有单词“test”的记录,无论是 1 行还是多行 - 因为这是一个通常包含很多文本的字段。

我在 Linux 和 Windows 服务器上使用 Neo4j 3.1.1 和 PHP 5.4。

谢谢B


已编辑

下面是创建两个节点的两条语句:

CREATE (c:Customer {nodeID:1})
SET c.customerRemark = "This is a test - Node 1"
RETURN c

CREATE (c:Customer {nodeID:2})
SET c.customerRemark = "This is a test with a linebreak inside - Node 2 Here comes text:
here was a linebreak"
RETURN c

声明:

MATCH (c:Customer)
WHERE c.customerRemark =~ '(?ui).*Node.*'
RETURN c

只返回节点 1 而不是节点 1 和 2

最佳答案

将标志 m ( multiline ) 和 s ( dotall ) 添加到您的正则表达式中。

MATCH (c:Customer) where c.customerRemark =~ '(?muis).*Node.*' RETURN c

关于neo4j - 换行符模式搜索?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45940685/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com