The .NET web system I'm working on allows the end user to input HTML formatted text in some situations. In some of those places, we want to leave all the tags, but strip off any trailing break tags (but leave any breaks inside the body of the text.)
What's the best way to do this? (I can think of ways to do this, but I'm sure they're not the best.)
You could also try (if the markup is likely to be a valid tree) something similar to:
The code above is a bit "scratch-pad" but if you cut and paste it into a Console application and run it, it does work :=)