如何运行与正则表达式中的Andr​​oid查询正则表达式、Andr、oid

2023-09-07 12:02:51 作者:是什么在改变你

我想运行在SQLite的查询使用Android的一个正则表达式。 我该怎么办呢?

I want to run a query in SQLite with a regexp using Android. How do I do that?

推荐答案

不幸的是,看起来并不像目前的Andr​​oid提供了一个方法可以让你注入一个用户函数进入sqlite的,这是你需要做 REGEXP 工作(具体而言,你需要指定一个用户函数的正则表达式()) - 所以你可能需要选择更多广泛(以 LIKE 的条件,它比你想要的正则表达式更广泛的),并进一步区分实际的结果(这真的是你想要的正则表达式匹配)与在应用程序中的java.util.regex ​​

Unfortunately it doesn't look like Android currently supplies a way for you to inject a user function into sqlite, which is what you'd need to make REGEXP work (specifically, you'd need a user function named regexp()) -- so you may have to select more broadly (with a LIKE condition that's broader than the regexp you want) and further distinguish "actual" result (those that really match the regexp you want) with java.util.regex in your application.