Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > sqlite regexp support

Reply
Thread Tools

sqlite regexp support

 
 
Rolando Abarca
Guest
Posts: n/a
 
      01-15-2008
What's the Right Way(tm) to implement regexp support in sqlite?
I'm doing this, but apparently it's not working:

db = SQLite3:atabase.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
else
func.result = false
end
end

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?

--
Rolando Abarca
Phone: +56-9 97851962
My Amazon Wish List: http://www.amazon.com/gp/registry/wi.../3AGJOT5E6SIQB


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[regexp] How to convert string "/regexp/i" to /regexp/i - ? Joao Silva Ruby 16 08-21-2009 05:52 PM
Ruby sqlite/gem error: Could not load sqlite adapter jhs408@gmail.com Ruby 4 04-18-2009 12:53 AM
Re: Does Python 2.5.2's embedded SQLite support full text searching? Daniel Fetchinson Python 3 04-22-2008 04:27 PM
Does Python 2.5.2's embedded SQLite support full text searching? python@bdurham.com Python 0 04-21-2008 04:10 PM
Installing sqlite-ruby when sqlite is in non-standard location Carl Youngblood Ruby 1 04-09-2005 03:32 AM



Advertisments