The tag template that I quickly wrote for a recent small project is one.
string tagPattern = @"<[!--\W*?]*?[/]*?\w+.*?>";
I used it like that
MatchCollection matches = Regex.Matches(input, tagPattern);
foreach (Match match in matches)
{
input = input.Replace(match.Value, string.Empty);
}
It will probably need to be changed in order to properly handle script or style tags.
source
share