ruby 1.8.6 (2007-09-24 patchlevel 111)
str = '\&123'
puts "abc".gsub("b", str) => ab123c
puts "abc".gsub("b", "#{str}") => ab123c
puts "abc".gsub("b", str.to_s) => ab123c
puts "abc".gsub("b", '\&123') => ab123c
puts "abc".gsub("b", "\&123") => a&123c <--- This I want to achieve using temporary variable
If I change str = '\&123'
to str = "\&123"
it works fine, but I get str
from match
function, so I cannot specify it manually within parantheses.... Is there any way to change string's 'string'
to "string"
behaviour ?