我试图在sqlite中使用正则表达式搜索数据库.这是我的代码:
cursor = db.rawQuery("SELECT _id, employee FROM employees WHERE employee REGEXP ?",
new String[]{"%" + prepareSearchText() + "%"});
adapter = new SimpleCursorAdapter(
this,
R.layout.search_row,
cursor,
new String[] {"_id", "employee "},
new int[] {R.id.idField, R.id.nameField});
setListAdapter(adapter);
但是我收到此错误:
Caused by: android.database.sqlite.SQLiteException: no such function: REGEXP.
之前我在MySQL中使用了函数REGEXP,所以我认为它存在于sqlite中,但显然它不是.
在android中查询sqlite数据库时执行正则表达式的最佳方法是什么?