title: Insert counter after regex match in string
body: <h2>Insert counter after match in string</h2>
  
  <p>I'm  trying to insert a count-suffix after each match in a string.</p>
  
  <p><strong>For example:</strong> Inserting a number after each matched "o" in the following string:</p>
  
  <pre><code>"The Apollo program was conceived early in 1960"
  </code></pre>
  
  <p>Would look like:</p>
  
  <pre><code>"The Apo1llo2 pro3gram was co4nceived early in 1960"
  </code></pre>
  
  <p>I guess I should use <code>gsub</code> maybe with <code>perl = TRUE</code>, but don't know how.</p>
  
  <pre><code>string &lt;- "The Apollo program was conceived early in 1960"
  
  gsub( x = string, pattern = "(o)", replacement = "\\1 $count", perl = TRUE )
  </code></pre>