using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"ns\d+:([\w-]+)";
string substitution = @"$1";
string input = @"<?xml version=""1.0""?>
<Period>
<AllContacts>
<Entry>
<ns0:entity-Person>
<ns0:CellPhone>3095550101</ns0:CellPhone>
<ns0:FirstName>Brrzzz</ns0:FirstName>
<ns0:LastName>Grbbs</ns0:LastName>
</ns0:entity-Person>
<ns0:PrimaryPhone>mobile</ns0:PrimaryPhone>
</Entry>
</AllContacts>
<State>TX</State>
</Period>";
Regex regex = new Regex(pattern);
string result = regex.Replace(input, substitution);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx