I am doing a news headlines section, where I would like to display, say, the first 50 characters or maybe the first 15 words of a string. But the string may have unescaped tags (eg., <BR>) that shouldn't count in the total. What's the most efficient way to do this?Also a concern is that the headline not end with an open tag (like a link). By this I mean two things:
<a href="http://ww
...and...
<a href="http://www.webmasterworld.com">WebMast
This is an interesting problem. I can think of a few ways to go at it, but what is the best way? Let's assume that a less-than character denotes a tag, and that there will be a greater-than character up stream.