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