So here comes the problem:
I want to paste an advertisement after a specified ##th paragraph.
Let me show:
<p><img src="an/images/pic.jpg" /></p>
<p>Intro text</p>
<p>A paragraph</p>
<p>Another paragraph</p>
I want to paste the advertisement below the second paragraph. The final code should be like that:
<p><img src="an/images/pic.jpg /></p>
<p>Intro text</p>
<div>Yepp, let's make money</div>
<p>A paragraph</p>
<p>Another paragraph</p>
I tried some regexp but i don’t get it. Ladies and Gentlemen please help me.
Taking RegEx match open tags except XHTML self-contained tags into consideration you might want to use a DOM/HTML parser for this.
prints