Solution:1
All you need to get is good regular expression, assuming that you managed to get it work at least partially, you propably had bad expression (example would help). I tested this code for you and it should work on all your <hr>
s:
$newtext=preg_replace("#(<hr[^>]*>)#s",$yourprefix."\${1}".$yoursuffix,$oldtext);
variable oldtext is what you had before, new text is what you want, and prefix and suffix is what you want to add around hr tag