Sqlite regexp support

What’s the Right Way™ to implement regexp support in sqlite?
I’m doing this, but apparently it’s not working:

 db = SQLite3::Database.new("test.db")
 db.results_as_hash = true
 db.create_function('regexp', 2) do |func, v1, v2|
   r = Regexp.new(v1.to_s)
   if v2.to_s.match(r)
     func.result = true
     func.result = false

and i’m running a query like this:

select * from table where column REGEXP ‘(www.)?somedomain.com

any hints?
what should return the regexp function?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs