15
1
using System;
2
using System.Text.RegularExpressions;
3
4
public class Program
5
{
6
public static void Main()
7
{
8
string input = "This is a test string which could be any text";
9
string exclude = "aeiou";
10
var stripped = Regex.Replace(input, "[" + exclude +"]", "");
11
Console.WriteLine(stripped);
12
var cleaned = Regex.Replace(stripped, "[ ]{2,}", " ");
13
Console.WriteLine(cleaned);
14
}
15
}
Cached Result