Orient-db 正则表达式修饰符 [英] Orient-db regex modifiers
问题描述
我正在使用 orient-db 数据库,但我遇到了正则表达式模式匹配问题.我真的需要在请求中出现不区分大小写的修饰符,但不知何故它并没有像我期望的那样工作.
I'm working with orient-db database, and I've issues with regex pattern matching. I really need case-insensitive modifier to be present in the request, but somehow it doesn't work as I'm expecting.
查询:
select from UserAccounts where email MATCHES '^ther.*'
以小写形式返回预期匹配项.
Returns as expected matches in lowercase.
每当我尝试添加修饰符时,在分隔符之外,即
Whenever I try to add a modifier, outside delimiters i.e.
select from UserAccounts where email MATCHES '\^ther.*\i'
我得到一个空集合.实际上,只要存在分隔符,查询就会返回一个空集合.
I get an empty collection. Actually the query returns an empty collection whenever delimiters are present.
如果无法附加修饰符,我可能会将每个alpha"字符替换为方括号中的表达式,即
If there is no way to attach modifiers I could probably replace each 'alpha' char to an expression in square brackets i.e.
select from UserAccounts where email MATCHES "^[tT][hH][eE][rR].*"
但我对这个解决方案并不满意.
But I'm not really happy with this solution.
推荐答案
使用 Java 不区分大小写的正则表达式修饰符(来自 Pattern 的特殊构造)在 OrientDB 1.7.9 中有效 - 以您的示例为例:
Using the Java case-insensitive regex modifier (from Pattern's special constructs) works in OrientDB 1.7.9 - for your example:
select from UserAccounts where email MATCHES '(?i)^ther.*'
(另见:模式 -特殊结构)
我也对相应的 OrientDB 问题添加了评论.
I've added a comment to the corresponding OrientDB issue as well.
这篇关于Orient-db 正则表达式修饰符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!