tags:

views:

47

answers:

2

Dear Sirs

I would like to know if it is possible to use [] in SQLite query as we used to in Access and other DB.

e.g. SELECT * FROM mytable WHERE fwords like '%b[e,i,a]d%'

this will retrieve all rows have fwords containing bad, bed, bid

Thanks a lot

A: 

From http://www.sqlite.org/lang_expr.html:

The LIKE operator does a pattern matching comparison. The operand to the right of the LIKE operator contains the pattern and the left hand operand contains the string to match against the pattern. A percent symbol ("%") in the LIKE pattern matches any sequence of zero or more characters in the string. An underscore ("_") in the LIKE pattern matches any single character in the string. Any other character matches itself or its lower/upper case equivalent (i.e. case-insensitive matching).

Does that help?

tdammers
gabriel66
I read this documentation as "No, LIKE does not support character classes". However, if you read further in the same document, you'll notice the REGEXP operator, which will provide you with a wider range of selection options.
tdammers
Dear tdammersSorry, but i realy don't have any idia about REGEXP so i did't rely on it especially they said it will raise an error.Thanks a lot
gabriel66
A: 

You can have a look at the regex section here.

thelost
Dear thelostSorry, but i realy don't have any idia about REGEXP.May you please guide me with the syntax.Thanks a lot
gabriel66