For Postgres you may try to enclose the string within $a$ instead of '' try query1 = "regexp_replace(lower(us2006_2010.title), '(<i>|</i>|<sup>|</sup>|[^[:alnum:]_])', '', 'g') = regexp_replace(lower($a$%s$a$), '(<i>|</i>|<sup>|</sup>| [^[:alnum:]_])', '', 'g')" % some_string
HTH On 15 sep., 12:48, Johann Spies <[email protected]> wrote: > This might be more a python problem than Web2Py: > > I am using the following query: > > query1 = "regexp_replace(lower(us2006_2010.title), > '(<i>|</i>|<sup>|</sup>|[^[:alnum:]_])', '', 'g') = > regexp_replace(lower('%s'), '(<i>|</i>|<sup>|</sup>|[^[:alnum:]_])', '', > 'g')" % some_string > > It works OK until query1 expands to the following (see the '2,2'-...) > > "regexp_replace(lower(us2006_2010.title), > '(<i>|</i>|<sup>|</sup>|[^[:alnum:]_])', '', 'g') = > regexp_replace(lower('2,2'-(Butane-1,4-diyl)dibenzimidazolium dichloride > dihydrate'), '(<i>|</i>|<sup>|</sup>|[^[:alnum:]_])', '', 'g')" > > How do I escape the ' after the second '2' in this query? > > I am using postgresql as database. > > Regards > Johann > > -- > May grace and peace be yours in abundance through the full knowledge of God > and of Jesus our Lord! His divine power has given us everything we need for > life and godliness through the full knowledge of the one who called us by > his own glory and excellence. > 2 Pet. 1:2b,3a

