Regular Expression question

Joined
Jan 10, 2007
Messages
43,898
Location
In The Machine
I want to replace all occurrences of illegal tags within an html string if that tag does not match my legal list.* WHat is the regex for that in C#?

string[] legal = {"b","p","div","span","font","i","li","ol","ul","br","center","strong","table","tr","td","tbody","hr","u",@"h\d"};

html = Regex.Replace(html,"]*>","",RegexOptions.IgnoreCase|RegexOptions.Singleline);

In this case it is matching all legal tags and removing them.* I want it to acutally remove all tags that are not apart of the legal list.

Tx



More...

View All Our Microsoft Related Feeds
 
Back
Top