using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"\d{2,}|(x\d)|(\dx)|[^\W\d]+\d\w*|\d+[^\W\d]\w*";
string substitution = @"$1$2";
string input = @"Red 1996 Corvette 2x - Matchbox
3 x SmartCar, broken 2nd door
White chevy F150, 1996
2nd edition Kindle (x3)
**1x** 2008 financial crash notice
Green bowl, cracked (stored in room 2A5)
Collectors Edition Beannie Baby, item 204/343
(6) Nissan window motors (1995-1998 ONLY)";
RegexOptions options = RegexOptions.Multiline;
Regex regex = new Regex(pattern, options);
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