Sorry for the cross post - wasn't sure what the best list to ask this was. I need a Perl RE to replace a specific HTML comment, something like: <!-- blahblahblah Josh blahblahblah --> I want to remove all comments with the word Josh in it. "Josh" could be anywhere inside the comment tags. Here's what I have (upon removing all line breaks): $text =~ s/<!--([^\-][^\-][^>])*?Josh([^\-][^\-][^>])*?-->//g; This doesn't match though. I don't believe I want to use a .*? in place of the ([^\-][^\-][^>])*? because there might be many comments in a page containing this word and I don't want to replace what's between the comments. Basically an open comment followed by zero or more characters that are NOT the closing comment tag sequence, followed by Josh, followed by zero or more characters that are not the closing comment tag sequence, followed by the closing comment tag. The problem is the "not closing comment tag sequence". Is this not the right way to do this? Should match: <!--Josh--> <!--Josh Rules--> <!--There goes Josh--> <!--Wow, Josh is Cool--> I've also tried lookahead assertions, but I'm not very good with those, so I'm probably flailing around wildly here: $text =~ s/<!--((?:(?!<!--)(?!-->)Josh)*)-->//gx; Neither of these seem to do the job. Any thoughts / suggestions? Thanks, Jsoh