I am attempting to clean up some dodgy xml attributes with Regular expressions.
My input string is this
<TD X:NUM class=xl101P24_2>I Want to send a FAX:but not </TD>
My intended output string is this
<TD class=xl101P24_2>I Want to send a FAX:but not </TD>
My code now looks like this
public static Regex regex1 = new Regex(
"<\\w*\\s*(X:\\w*)",
RegexOptions.IgnoreCase
| RegexOptions.CultureInvariant
| RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
public void doRegex()
{
string InputText = @"<TD X:NUM class=xl101P24_2>I Want to send a FAX:but not </TD>";
string result = regex1.Replace(InputText,"");
//result now = " class=xl101P24_2>I Want to send a FAX:but not </TD>"
}
so I need to do the replace but on only want to replace the numbered sub-match i.e. the 'X:NUM'. How do I do this???
Michael