using System; using System.Text.RegularExpressions; public class Test { public static void Main() { string[] strings = { "File name without 3 digit end.jpg", " Test", " Test (1)", " Test (1) (2)", " Test (123) (232)"}; foreach (String s in strings) { Console.WriteLine(Regex.Replace(s, @"^(.*) \(\d+\)", "$1")); } } }