My string can be "Wings U15 W" or "Wings U15W" or "Wings U15M" or "Wings U15 M" I would like to get output as "Wings U15" my code as below.
string _Input = "Wings U15 W";
if (Regex.Match(_Input, " U[0-9]{2} (W|M)").Success)
{
string pattern = "U[0-9]{2} (W|M)";
string replacement = "";
_Input = Regex.Replace(_Input, pattern, replacement);
}
MessageBox.Show(_Input);