I am unable to find solution to seemingly very simple problem. I need to execute a raw query in Room database but the query has REGEX
function in it. So, I tried to write it like we usually do with the LIKE
keyword:
val query = "SELECT * FROM some_table WHERE some_column REGEX '(^| )('||?||')( |$)'"
Similar to how we use LIKE
keyword:
REGEX '(^| )(' ||?|| ')( |$)'
LIKE '%' ||?|| '%'
And afterwards:
tableDao.search(
SimpleSQLiteQuery(query, arrayOf("believe"))
)
But it doesn't return anything, whereas if I manually execute this query in DB Browser for SQLite, it returns exactly what I'm expecting.
What am I doing wrong here?