Regular Expression Using Sqlite In Android
I having a difficulty with regex, I have a table products that of one of it`s field is a period. I want to filter records by a period the user entered in my application. for exampl
Solution 1:
Products.period like'%[0-9]+%'
LIKE
does not work with regexps.
To use regular expression matching, use the REGEXP
operator. Note that by default the REGEXP
operator is not implemented, even though the syntax supports it.
For simpler matching needs you can also consider GLOB
.
I want to filter all the records that contain only the pattern 2006-
You don't need a regular expression for that.
Products.period like'2006-%'
will match anything where period
starts with the string 2006-
.
I meant any year with "-" symbol at the end
Products.period like'%-'
will match anything where period
ends with the string -
.
Post a Comment for "Regular Expression Using Sqlite In Android"