ActiveRecord and SQL Regular Expressions


I have the following code:

    @my_things = MyThing.find(
      :select => "ID, CODE",
      :conditions => conditions_list)

conditions_list is an array, with the following elements :

[0] code like ? and comp_cas_no like ? and PRODUCT like '%R%' and
(PRODUCT like ? or PRODUCT like ?)
[1] %74%
[2] %98%
[3] %22%
[4] %25%

Now, I'd like to replace "PRODUCT like ?" in conditions_list[0] with
an Oracle Regular Expression, like this :

"REGEXP_LIKE( PRODUCT, 'R[[:digit| |/]*?')"

where "?" would be replaced with one of the other values in
conditions_list, just like with the query above. Unfortunately, "?"
will be taken literally here...

I guess one option would be to use MyThing.find_by_sql() and recreate
the SQL query in its entirety, but I'm hoping someone can help me keep



Thanks to Baptiste on Railsfrance, the solution is as follows :

The query includes: REGEXP_LIKE( PRODUCT, ?)
The passed-in argument looks like this: "R([:digit]| |/)*(26|36)" (26
and 36 are examples)