title: Insert Sequential Number using Regular Expression
body: <p>Given:</p>
  
  <pre><code>pad_
  pad_
  pad_
  </code></pre>
  
  <p>How would it be possible to use a regular expression to act like a "for loop" to obtain:</p>
  
  <pre><code>pad_1
  pad_2
  pad_3
  </code></pre>
  
  <p>I am aware that numbered sequences such as <code>\1</code> and <code>\2</code> can be used in replacement expressions to indicate <code>()</code> captures in existing text, but can a single replacement expression generate its own replacement values as a numerical sequence? Is there some kind of trick to make this happen besides keeping on-hand a text file with a sequence of numbers that I can copy/paste, or writing a quick application that outputs text using a "for loop"?</p>
  
  <p><strong>CONCLUSION</strong>: I get the impression that the regular expression syntax is not a standard uniformly implemented by text editing applications, nor does it include anything that meets the purpose of utilizing match counts in replacement expressions or initiating replacement text sequences. Unfortunately, that means that I would need to use text editors like vim that could do this for purposes unsuited to them, or attempt to find or make application plugins for the text editor or IDE that I would be using. But it would actually be much simpler to compile and run a quick "for loop" that prints the strings for me to copy/paste and which I can reuse by altering in minor ways, or to use <code>awk</code> which was suggested.</p>