using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(""[a-zA-Z 0-9]+)(?:-\d)+(?="")";
string substitution = @"\1";
string input = @"""Article number"" ""Name"" ""Third Column""
""Shorts Artic"" ""Swa..."" ""2018-07-28""
""Shorts Artic-1"" ""Swa..."" ""stl 31-35-1-1-1-1-2-2-2-1-1""
""Shorts Artic-2-1"" ""Swa..."" ""https://test-domain.com/...""
""Shorts Artic-2-2-1"" ""Sw..."" ""
""Shorts Artic-2-2-2-2-1"" ""Ba..."" ""-asd""
""Shorts Artic-2-2-2-2-2-1"" ""Nus...""
""Shorts Artic-2-2-2-2-2-1-1"" ""Lek..""
""0858-1"" ""Jacket Blue..""
""0858-2-1"" ""Jacket Re..""
""0858-2-2-1"" ""Int...""
""0858-2-2-2-1"" ""In...""
""0858-2-2-2-2-1"" ""Int...""
""0858-2-2-2-2-2-1"" ""Int...""
""0858-2-2-2-2-2-2-1"" ""Int...""
""0858-2-2-2-2-2-2-2-1"" ""In...""
""0858-2-2-2-2-2-2-2-2"" ""In...""
""0858-2-2-2-2-2-2-2-1"" ""In..."" ""6 107-124 cm""";
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