in reply to HTML Matching

Why strip them out? Just use the encode_entities function from HTML::Entities on the string.