Problem in sqlite with "like" in android

In sqlite operator [] does not exist for a statement.

For instance,

select * from user where name LIKE '%[abch]%';

this work is all the rest sqlserver , oracle , but not in sqlite .

Does anyone know an alternative in sqlite for this?

I am working with android.

I think I cannot use regexp because I use android .

+4
source share
1 answer

sqlite only supports a small subset of regular sql. http://www.sqlite.org/lang_expr.html

See SQLiteDatabase Query Android with Regex on using regex on Android.

Short answer, don’t worry. You can use like for the basics and all that you really don't need to use regex for.

You can always do this select * from user where name LIKE '%a%' or name LIKE '%b%' or name LIKE '%c%' or name LIKE '%h%' ;

+1
source

Source: https://habr.com/ru/post/1445180/


All Articles