string StripHTML(string htmlString){
//This pattern Matches everything found inside html tags; //(.|\n) - > Look for any character or a new line // *? -> 0 or more occurences, and make a non-greedy search meaning //That the match will stop at the 1st available '>' it sees, and not at the last one //(if it stopped at the last one we could have overlooked //nested HTML tags inside a bigger HTML tag..) string pattern = @"<(.|\n)*?>"; return Regex.Replace(htmlString, pattern, string.Empty); }
07 July 2010
Code : Strip HTML (Remove HTML Tags)
Subscribe to:
Post Comments (Atom)
0 Comments:
Post a Comment