Reputation: 3749
Is there anyway in ruby on rails to make a query using regexp?
Upvotes: 2
Views: 3183
Reputation: 51717
I think it might depend on the database. I know in MySQL you can do something like:
Model.find(:conditions => "field REGEXP '.*'")
if you want a true regex, or you can use the LIKE syntax for similar string matching.
While it doesn't have regex, there's also a gem called MetaWhere that provides more advanced finder functionality.
Upvotes: 6