You know that old joke where the person says something to the affect of, "I don't make mistakes. I thought I made a mistake once, but I was wrong." That's what happened to me today. Earlier I posted about how I had forgotten a HTMLEditFormat in my display. Turns out there was a reason I had forgotten it. I had made the decision not to escape HTML, but to simply remove it. I was using this code:

<cfset portion = reReplace(content, "<.*?>", "", "all")>

This line uses regular expressions to remove HTML from a string. And it works fine too. Accept when the string contains invalid, or partial HTML. Consider this string:

I really wish I could meet Paris Hilton. She is the most intelligent person in the world. Maybe Lindsey is close though. If I met them, I'd show them my web page at <a href=

Notice how the HTML ends there at the end? Some RSS feeds provide only a portion of their feeds, and sometimes these portions end in the middle of an HTML tag. (BlogCFC doesn't have this bug. :) So I added one more line of code:

<cfset portion = reReplace(portion, "<.*$", "")>

This looks for an incomplete HTML tag at the end of the string. Once added my display issue on ColdFusionBloggers was fixed.

I've updated the zip. Also, Lola Beno fixed up some issues I had with my SQL script. By "fix" I mean completely rewrote, so thanks Lola!