Remove HTML Tags In An XML String Document Using Regular Expressions (REGEX) In C#
Here's a regex pattern that will match html tags that are present in an xml string document. Where xml, node1, node2, node3, node4, node5, node6 and node7 are xml tags. node1 could represent a valid xml tag name like employername or similar tag names.
Greg
xmlStringData = Regex.Replace(xmlStringData, @"<((\??)|(/?)|(!))\s?\b(?! (\b(xml|node1||node2|node3|node4|node5|node6|node7)\b))\b[^>]*((/?))>", " ", RegexOptions.IgnoreCase);
Comments
Post a Comment