$html =~ s/<($tag[^>]*?)>/{{{$1}}}/sgi;# temp-encode starting tags $html =~ s/<\/($tag[^>]*?)>/{{{\/$1}}}/sgi; # temp-encode ending tags $html =~ s/<[^>]*?>//sgi;# kill all remaining tags $html =~ s/\{{3}//sgi;# re-encode '>'tags