1 2 3 4
// ** DO NOT USE ** // THIS IS BAD BROKEN CODE, ONLY DISPLAYED FOR BENCHMARKING PURPOSES! if (!tagpaired[i] && !ignoredtags.Contains(tagname)) ...
1 2 3 4
var ignoredtags = new List<String> { "p", "img", "br" }; if (!tagpaired[i] && !ignoredtags.Contains(tagname)) ...
1 2 3 4
private static Regex _namedtags = new Regex (@"</?(?<tagname>\w+)[^>]*(\s|$|>)", RegexOptions.Singleline | RegexOptions.ExplicitCapture); ...
C# Balance HTML Tags
For the subset of HTML tags...
1 2 3 4
private static Regex _tags = new Regex("<[^>]*(>|$)", RegexOptions.Singleline | RegexOptions.ExplicitCapture | RegexOptions.Compiled); private static Regex _whitelist = new Regex(@" ^</?(a|b(lockquote)?|code|em|h(1|2|3)|i|li|ol|p(re)?|s(ub|up|trong|trike)?|ul)>$ ...
C# Sanitize HTML
Takes a provided HTML strin...
> I would worry that you're...