Strip Html by regex - CSharp System

CSharp examples for System:String HTML

Description

Strip Html by regex

Demo Code


using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic;
using System;//from  w w w.ja v a2  s  .  co m

public class Main{
        public static string StripHtml(this string html)
        {
            if (string.IsNullOrEmpty(html))
                return string.Empty;

            return Regex.Replace(html, @"<[^>]*>", string.Empty);
        }
}

Related Tutorials