1. pattern = string.Format(@"
  2. (?:
  3. (?<=nn) # Starting after a blank line
  4. | # or
  5. An? # the beginning of the doc
  6. )
  7. ( # save in $1
  8. [ ]{{0, {0}}}
  9. <(hr) # start tag = $2
  10. b # word break
  11. ([^<>])*? #
  12. /?> # the matching end tag
  13. [ t]*
  14. (?=n{{2,}}|Z) # followed by a blank line or end of document
  15. )", tabWidth - 1);
  16. text = Regex.Replace(text, pattern, new MatchEvaluator(HtmlEvaluator), RegexOptions.IgnorePatternWhitespace);