C# equivalent for strip_tags() in PHP

There’s a rather pretty way to use something like PHP strip_tags() function in C# just using regular expresion

using System.Text.RegularExpressions;
#....
Regex regHtml = new System.Text.RegularExpressions.Regex("<[^>]*>");
string s = regHtml.Replace(InputString,"");

 

Leave a Reply

Your email address will not be published. Required fields are marked *