title: Using named capture groups inside Ruby gsub blocks (regex)
body: <p>I'm trying to use a named capture group inside a block in Ruby. <code>$1</code> still works, but I'd like to reference it using the name I gave. </p>
  
  <pre><code>"foo /(bar)".gsub(/(?&lt;my_word&gt; \(.*?\) )/x) do |match|
    puts "$1 = #{$1} and $my_word = #{$my_word}"
  end
  </code></pre>
  
  <p>Expected:<code>$1 = (bar) and $my_word = (bar)</code></p>