Q:

C# Replace group of numbers in a string with a single character

Does anybody know I can replace a group of numbers in a string by one *. For example if I have a string like this "Test123456.txt", I want to convert it to "Test#.txt". I have seen plenty of examples that can replace each individual number with a new character, but none that deal with a group of numbers. Any help is much appreciated!

A:

Regex r = new Regex(@"\d+", RegexOptions.None);
            Console.WriteLine(r.Replace("Test123456.txt", "#"));
            Console.Read();

