From: "Mikael Høilund" Date: 2008-05-29T18:02:35+09:00 Subject: Re: Strings, postgresql and gsub On May 29, 2008, at 10:47, J-H Johansen wrote: > irb(main):033:0* s = "blah'blah" > => "blah'blah" > irb(main):034:0> s.gsub(/'/, "\\'") > => "blahblahblah" String#gsub interprets the backslashes (for use with e.g. \1). In this case it's replaced with everything after the '. Escape it doubly to ge t what you want: >> s = "blah'blah" => "blah'blah" >> puts s.gsub(/'/, "\\\\'") blah\'blah -- Name = "Mikael Høilund"; Email = Name.gsub %r/\s/,%#=?,# ## visit *a=e=?=,!????,:??,?,,Email.downcase![eval(%["\\%o\\%o"]% ## http:// [?**2+?o,?\\*2])]="o";Email.gsub! %%\%c%*3%a, %?%c? % ?@ ## hoilund def The(s)%%\%s.%%s+%.org\n.end; :Go and print The Email ## dot org