public static string StripTags(this string input)
{
if (String.IsNullOrEmpty(input)) return String.Empty;
//
Special handeling of double line-breaks after a sentence ends
const string lineBreakPattern = @"(\.<br.*?><br.*?>)(?=[A-Z])";
input = Regex.Replace(input,
lineBreakPattern, ". ");
//
Replace all tags
const string htmlTagPattern = "<.*?>";
input = Regex.Replace(input,
htmlTagPattern, String.Empty);
return input;
}
No comments:
Post a Comment