I am editing large html file and it is necessary to insert <span id="%d"></span> (where %d is the number of match) into the <p></p> tags.
Sample Input:
<p>stack</p>
<p>overflow</p>
Desired Output:
<p><span class="class" id="f=1">stack</p>
<p><span class="class" id="f=2">overflow</p>
To match the <p></p> I use the following regular expression to match results:
<p>(.*?)<\/p>
Afterwards, matches are substituted with:
<p><span class="class" id="f=???">$1</span></p>
Is it available reference to the number of match from pattern? ("f=???")
 
     
     
    