1 2 3 4
private static Regex _namedtags = new Regex (@"</?(?<tagname>\w+)[^>]*(\s|$|>)", RegexOptions.Singleline | RegexOptions.ExplicitCapture); ...
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...
For the subset of HTML tags...