title: How can I interpolate a variable in a Ruby regex?
body: <pre><code> data.to_enum(:scan,/(#entity[0])/i).map do |m,|
          p $`.size
  </code></pre>
  
  <p>How can I use dynamic variable in regular expression?
  <code>#entity[0]</code> returns a value, but in the above syntax #entity[0] is taken literally in the regex.</p>