正则表达式集合

HTML去空白回车换行
private static readonly Regex REGEX_LINE_BREAKS = new Regex(@"\n\s*", RegexOptions.Compiled);

private static readonly Regex REGEX_LINE_SPACE = new Regex(@"\n\s*\r", RegexOptions.Compiled);

private static readonly Regex REGEX_SPACE = new Regex(@"( )+", RegexOptions.Compiled);



var targetHtml = REGEX_SPACE.Replace(REGEX_LINE_SPACE.Replace(REGEX_LINE_BREAKS.Replace(baseInfoHtml, ""), ""), " ");

 

你可能感兴趣的:(正则表达式)