title: Ruby gsub with index/offset?
body: <p>Does Ruby's <a href="http://www.ruby-doc.org/core-1.9.3/String.html#method-i-gsub" rel="noreferrer">String#gsub</a> method provide a means for including the index of the replacement?  For example, given the following string:</p>
  
  <blockquote>
    <p>I like you, you, you, and you.</p>
  </blockquote>
  
  <p>I want to end up with this output:</p>
  
  <blockquote>
    <p>I like you1, you2, you3, and you4.</p>
  </blockquote>
  
  <p>I know I can use <code>\1</code>, <code>\2</code>, etc. for matching characters in parentheses, but is there anything like <code>\i</code> or <code>\n</code> that would provide the number of the current match?</p>
  
  <p>It's worth mentioning that my actual term is not as simple as "you", so an alternate approach that assumes the search term is static will not suffice.</p>