public string Parse(PostFilterContext context) { var msg = context.HtmlToParse; var regex = @"((www\.|(http|https|ftp|news|file)+\:\/\/)[_.a-z0-9-]+\.[a-z0-9\/_:@=.+?,##%&~-]*[^.|\'|\# |!|\(|?|,|\s|>|<|;|\)])"; var r = new Regex(regex, RegexOptions.IgnoreCase); return r.Replace(msg, match => { if (msg[match.Index - 1] == '"') return match.Value; return string.Format(@"<a href=""{0}"">{0}", match.Value); }).Replace("href=\"www", "href=\"http://www"); }
public string Parse(PostFilterContext context) { return Regex.Replace(context.HtmlToParse, @"<h(?<number>[1-6])>(?<innerText>[^<]*)</h[1-6]>", FormatHeadings); }