Skip to content

Instantly share code, notes, and snippets.

@sandro
Created April 9, 2009 17:43
Show Gist options
  • Save sandro/92622 to your computer and use it in GitHub Desktop.
Save sandro/92622 to your computer and use it in GitHub Desktop.
html = html.Replace("://", ":~~");
if ((ConfigurationManager.AppSettings.Get("RemoveWhitespaceMode") + string.Empty).Equals("Insane", StringComparison.OrdinalIgnoreCase))
{
html = Regex.Replace(html, @"(\/\*(\s*|.*?)*\*\/)|(\/\/.*)", String.Empty); // remove javascript comments
html = Regex.Replace(html, @"(?<=[^])\t{2,}|(?<=[>])\s{2,}(?=[<])|(?<=[>])\s{2,11}(?=[<])|(?=[\n])\s{2,}", string.Empty);
html = Regex.Replace(html, @"[ \f\r\t\v]?([\n\xFE\xFF/{}[\];,<>*%&|^!~?:=])[\f\r\t\v]?", "$1");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment