I'm pretty new to PHP and have a String which contains an HTML page. I'd need to insert some custom code BEFORE and AFTER any HR HTML tag. Example:
<html>
....
<p>INSERT HERE</p>
<hr class="pagebreak">
<p>INSERT HERE</p>
<p>INSERT HERE</p>
<hr class="pagebreak">
<p>INSERT HERE</p>
....
</html>
I've tried with several combinations of preg_replace and substr_replace, however I still couldn't manage to insert the custom code in all places I need. Anybody can help me to solve this puzzle ? P.s. I need to use PHP standard String functions- I cannot use any HTML parsing library since I don't have control over the PHP libraries available on the server. Thanks a lot Linda