title: How to escape slashes in single-quoted strings?
body: <p>In Ruby 1.8.6 (2007-09-24 patchlevel 111):</p>
  <pre><code>str = '\&amp;123'
  puts &quot;abc&quot;.gsub(&quot;b&quot;, str) =&gt; ab123c
  puts &quot;abc&quot;.gsub(&quot;b&quot;, &quot;#{str}&quot;) =&gt; ab123c
  puts &quot;abc&quot;.gsub(&quot;b&quot;, str.to_s) =&gt; ab123c
  puts &quot;abc&quot;.gsub(&quot;b&quot;, '\&amp;123') =&gt; ab123c
  puts &quot;abc&quot;.gsub(&quot;b&quot;, &quot;\&amp;123&quot;) =&gt; a&amp;123c &lt;--- This I want to achieve using temporary variable
  </code></pre>
  <p>If I change <code>str = '\&amp;123'</code> to <code>str = &quot;\&amp;123&quot;</code> it works fine, but I get <code>str</code> from <code>match</code> function, so I cannot specify it manually within parentheses. Is there any way to change the <code>'string'</code> to <code>&quot;string&quot;</code> behavior?</p>