Thursday, April 19, 2012

Regex in html list tag not working (multiline string)

I have this string:
< li class="MsoNormal" style="color:white;mso-themecolor:background1; mso-margin-top-alt:mso-list:l1 level1 lfo1;tab-stops:list 36.0pt">
and the regex has a lazy quantifier to replace the string above to < li>. Using a simple regex pattern, it won't change the string above to ordinary < li>. The solution would be to add a regex to replace new line characters. Since the string has newline characters.
Regex.Replace(source, @"\n", string.Empty, RegexOptions.IgnoreCase);


Post a Comment