If you need more advanced matching (I.E. full regex, beyond what GLOB
can do) you could implement a custom function. A regex search is always
going to have to resort to a full table scan anyway, so it won't hurt
performance any.

John

-----Original Message-----
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin
Sent: Thursday, October 15, 2009 6:00 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] regular expression search


On 15 Oct 2009, at 10:24pm, Farkas, Illes wrote:

> I have strings in a database and I would like to find all of them
> matching a pattern that is 5-10 characters long. In each position of
> the pattern up to three different characters may be allowed. This
> would be a typical regular expression that I'd like to find:
>
> A (B | C | D ) D ( A | D ) B B

First guess would be to use GLOB:

http://www.sqlite.org/lang_corefunc.html#glob

Either as an infix operator, or as a function:

http://www.sqlite.org/lang_corefunc.html#glob

I cannot find a page which gives SQLite examples using GLOB, but this  
page

http://en.wikipedia.org/wiki/Glob_(programming)

gives examples showing the use of square brackets, which appears to be  
what you want.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to