Program to remove HTML tags from a given String | C # program for the above approach ; Function to remove the HTML tags from the given tags ; Use replaceAll function in regex to erase every tags enclosed in < > str = Regex . Replace ( str , " < . * ? > " , String . Empty ) ; Print string after removing tags ; Driver code ; Given String ; Function call to print the HTML string after removing tags
using System ; class GFG { static void RemoveHTMLTags ( String str ) { System . Text . RegularExpressions . Regex rx = new System . Text . RegularExpressions . Regex ( " < [ ^ > ] * > " ) ; str = rx . Replace ( str , " " ) ; Console . WriteLine ( str ) ; } public static void Main ( String [ ] args ) { String str ; str = " < div > < b > Geeks ▁ for ▁ Geeks < / b > < / div > " ; RemoveHTMLTags ( str ) ; } }