public static string StripHtmlComments(string html)
{
if (html == null)
...
C# On Strip Html Comments
by Jeff Atwood,
November 16, 2009 04:25
// ** DO NOT USE ** // THIS IS BAD BROKEN CODE, ONLY DISPLAYED FOR BENCHMARKING PURPOSES! if (!tagpaired[i] && !ignoredtags.Contains(tagname)) ...
var ignoredtags = new List<String> { "p", "img", "br" };
if (!tagpaired[i] && !ignoredtags.Contains(tagname))
...
private static Regex _namedtags = new Regex
(@"</?(?<tagname>\w+)[^>]*(\s|$|>)",
RegexOptions.Singleline | RegexOptions.ExplicitCapture | RegexOptions.Compiled);
...
C# Balance HTML Tags
For the subset of HTML tags...
private static Regex _tags = new Regex("<[^>]*(>|$)",
RegexOptions.Singleline | RegexOptions.ExplicitCapture | RegexOptions.Compiled);
private static Regex _whitelist = new Regex(@"
...
C# Sanitize HTML
Takes a provided HTML strin...
That "invalid HTML tag" cas...