I actually started working on adding this to SQLite two days ago, for exactly the same reason (MySQL compatibility). I'll be using pcre to process regular expressions rather than Boost, though, not that that matters much. Having a second implementation to compare to will be very useful, thanks.
Given how often requests for this functionality are posted to this list, and given that there are now multiple people working to implement it: is there any chance that this can be merged into the main tree (as a compile-time option, of course)? -Tom > -----Original Message----- > From: John Buck [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 10, 2005 9:21 PM > To: sqlite-users@sqlite.org > Subject: [sqlite] REGEXP as an operator > > Greetings, > > I am new to this list and the Sqlight project. > > I ran across it while doing research on locating an > alternative to the Mysql > Embedded engine. Sqlite seems like it will do the trick with > a few tweaks. > I just wanted to share one of those tweaks for comment. > > > One problem I ran into was I had used REGEXP as an operator throughout > hundreds of lines of SQL. > > So with a little work I added REGEXP as an operator to Sqlite 3.21. > You can download the change for a limited time from > municipal-software.com/Sqlite3.21REGEXP.zip > > > I use this with both windows (Visual Studio) and linux (GCC) compiler. > > It makes use of the boost regular expression library available at > www.boost.org. > > If you do not want to use the Boost implementation, you can > create your own > in the file Extensions.cpp. > (just replace the call to the boost library with what-ever > you want to use) > > To enable the REGEXP operator, > Replace the files in the sqlite folder with those contained > within the zip > file. > > Compile with SQLITE_BOOST_REGEXP defined. (Depending on your > environment you > might need to first compile Extensions.cpp and link with the resulting > object) > > If you compile without SQLITE_BOOST_REGEXP defined, regexp > will be a synonym > for glob, and the boost library is not necessary. > > > Why do it this way and not simply use sqlite3_create_function? > > In Mysql, REGEXP is an operator, and I was looking to make a drop in > replacement to an existing project with hundreds of lines of > SQL already > written where REGEXP is used as an operator. (IE: Field > REGEXP '.*10$' > ). > > The changes are simple enough that maybe they can be added to the next > release. > > -- > John Buck > [EMAIL PROTECTED] >