in reply to regexp: least inclusive match?

Another way to do it would be to use regular expression with a negative look-ahead assertion. Substitute from the marker word to end of string with nothing as long as the marker word is not followed by another occurrence, thus it will only match from the last marker word onwards.

use strict; use warnings; my $blog; { local $/; $blog = <DATA>; } my $word = q{Tags}; my $rxStrip = qr {(?xs) \b$word\b (?!.*\b$word\b) .* }; $blog =~ s{$rxStrip}{}; print $blog; __END__ Tags are very useful to included in these posts. Interested in growi +ng a home based business go here. Tags: Vemma Builder · wallstrip · Vemma · Vegas // Mar 2nd 2007 at 3:30 am vemma killa Leave a Comment Name Mail Website

I hope this is of interest.

Cheers,

JohnGG