I created this regex and apparently it's almost the way I would like it, however, I'd like to insert the <img>
tag after the third occurrence of a sequence of paragraphs. The way I did it is inserting <img>
after the first paragraph of all occurrences.
That is, every third occurrence of a paragraph <p>
, I would like to insert a <img>
tag.
(<p(.*?)>)([[:space:]]+?|.*?|[[:space:]]+?)(<\/p>)
Here is the example I made: link
Example of how my regex was:
Data entry:
<p>texto1</p>
<p>texto1</p>
<p>texto1</p>
Result:
<p>texto1</p>
<img src="">
<p>texto1</p>
<img src="">
<p>texto1</p>
<img src="">
Here's how I'd like to:
<p>texto1</p>
<p>texto1</p>
<p>texto1</p>
<img src="">
<p>texto1</p>
<p>texto1</p>
<p>texto1</p>
<img src="">