title: Ruby regex capture groups in gsub
body: <p>Say I want to switch each letter in a message with it's place in the reverse alphabet. Why can't I seem to use the captured group and do it in one gsub? </p>
  
  <p>Perhaps someone could explain in general about using captured groups in gsub, can the back references be bare(no ' ')? Can I use #{\1}? </p>
  
  <pre><code>def decode(message)
    a = ('a'..'z').to_a
    z = a.reverse
    message.gsub!(/([[:alpha:]])/, z[a.index('\1')]) 
  end
  
  decode("the quick brown fox")
  </code></pre>