in reply to insert html tags
s{(</ul>)}{$tags_to_insert$1}g; [download]
Note though that the resulting string doesn't seem to be valid HTML to me.