Gsub fail

Hi guys: I’m trying go through a table, read a field, escape out all the
single quotes in there, and write it back again. For some reason my
gsub, even though by all accounts looks right, doesn’t seem to be
working. Here is my code:


y.text.gsub("’","\\’")
thesql = “text = '”+y.text+"’"
Capture.update_all( thesql, "id = "+y.id.to_s )

Constantly breaks on an entry that includes
“It’s going up on…”

right at the ’ in It’s.

Any ideas? I even wrote a loop to recurse through the string and make
sure that I was a really a single quote (39)

Thanks…Chris

y.text.gsub("’","\\’")
Nothing is changing here. You need to add a bang.

Sharagoz – wrote:

y.text.gsub("’","\\’")
Nothing is changing here. You need to add a bang.

Doh! Thanks. I was using the same code elsewhere but without the bang.