sub eraseCommet { my($all, $comment) = @_; return $all if !$comment; } s/(<(\/)?((!--)|(script)|(style)|\w+)(?(4).*?-->|(\s+\w+(?:\s*=\s*(["'])?(?(8)[^\8]+?\8|\S+?(?=[>\s])))?)*?\s*\/?>(?(5).*?<\/script>|(?(6).*?<\/style>))))/eraseCommet($1,$4)/gixse;