Replace html tag from html string using regex - CSharp System

CSharp examples for System:String HTML

Description

Replace html tag from html string using regex

Demo Code


using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;//from   w w w . j  ava  2s.c  o  m

public class Main{

        public static string RexReplace(this string str)
        {
            if (string.IsNullOrWhiteSpace(str))
            {
                return "";
            }
            Regex nr7 = new Regex(@"<[\s\S]*?>", RegexOptions.IgnoreCase | RegexOptions.Multiline);
            str = nr7.Replace(str, "");
            return str;
        }
}

Related Tutorials