I want to do the following (and I suspect the easiest way to be a
regular expression that uses a user-function):
Given the string...
--------
<p>Hello</p>
<p class="bla">World</p>
<h3>Hello User</h3>
<p>How are you</p>
--------
I want to change it to:
--------
<p>Hello</p>
<div class="annotation">That was paragraph 1</div>
<p class="bla">World</p>
<div class="annotation">That was paragraph 2</div>
<h3>Hello User</h3>
<p>How are you</p>
<div class="annotation">That was paragraph 3</div>
--------
So in other words, I want to add a string after every paragraph with a
iterated number. So I suspect I can do the following:
- Replace all "</p>" with "</p>...<div ..$n..." but increase the $n by
1 for every time
Can anybody tell me how to do this? Thanks!