I would create counters with the value of the position of < and >. Then when the br counter reaches the point where the br tag should be placed check your < counter and > counter. If the < counter is higher than the > counter you should put the br at the place of the < counter.
Does this makes sense or should I elaborate a bit more?
Regards,
Ronald
Seems like this could be solved with a smart library that finds plain text in HTML. I would think there are a bunch out there. Getting this 100% right yourself will be fairly hard but you can probably get away with Ronalds suggestion and including some other special cases for all the html entities.
Are you sure this is the right place to solve this problem though? Why are the lines not just auto-wrapping in the exported documents? You can probably configure this explicitly using CSS but is there a reason? As far as I know the default will just be that can break on the end of a word.