in reply to Matching HTML Comments

This is because the .+ operator is greedy: it matches the longest strings it possibly can.( This is generaly a good a thing).

A quick fix would be to change .+ to .+?.

You can read more about this issue in perldoc perlre.