Gsubbing ' to \'

I was trying to escape some apostrophes with gsub. The only way I could
get it to work is by doing:

result.gsub!(/’/) {%q!’!}

There has got to be a better way than this. What was I doing wrong?

-Kurt

Try: result.gsub!(/‘/) { "\’" }

Kurt M. Dresner wrote:

···

I was trying to escape some apostrophes with gsub. The only way I could
get it to work is by doing:

result.gsub!(/'/) {%q!'!}

There has got to be a better way than this. What was I doing wrong?

-Kurt