7

I am trying to fetch entries from a SQLiteDatabase in an Android program using the query function using the selection parameter. I have had success with simple pattern matching using the SQLite's LIKE and the % wildcard. Now I want to do more complex pattern matching using regular expressions.

According to the SQLite website, for the REGEXP operator to function, it must be user defined. Has anyone had any success creating use defined SQLite functions for Android's SQLiteDatabase? Or has anyone found another way to use regular expressions when searching through strings in a database?

1
  • I imagine getting SQLite to use user defined functions in Android would be tricky, although I guess it might be possible with NDK Commented Jul 1, 2011 at 14:44

1 Answer 1

1

As described here

The REGEXP operator is a special syntax for the regexp() user function. No regexp() user function is defined by default and so use of the REGEXP operator will normally result in an error message. If a application-defined SQL function named "regexp" is added at run-time, that function will be called in order to implement the REGEXP operator.

But there is GLOB which is little more advanced than LIKE.

Sign up to request clarification or add additional context in comments.

1 Comment

GLOB looks promising, I'll give that a shot later. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.