using System.Text.RegularExpressions;
using System.Globalization;
public static void Main()
ProcessText(@"D'Ambrosi Rebecca");
ProcessText(@"Evans De'Queela");
ProcessText(@"Gerald Preiß");
private static void ProcessText(string text)
var output = ConvertVowelMutation(text);
output = RemoveDiacritics(output);
output = RemoveIllegalChars(output);
Console.WriteLine(output);
private static readonly (string original, string target)[] _mutatedVowels = new (string original, string target)[]
private static string ConvertVowelMutation(string text)
if (string.IsNullOrWhiteSpace(text))
foreach (var mutatedVowel in _mutatedVowels)
text = text.Replace(mutatedVowel.original, mutatedVowel.target);
private static string RemoveDiacritics(string text)
if (string.IsNullOrWhiteSpace(text))
text = text.Normalize(NormalizationForm.FormD);
var chars = text.Where(c => CharUnicodeInfo.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark).ToArray();
return new string(chars).Normalize(NormalizationForm.FormC);
private static readonly Regex _legalCharRegex = new Regex(@"([0-9]|[a-z]| |-|_)*", RegexOptions.IgnoreCase);
private static string RemoveIllegalChars(string text)
var r = _legalCharRegex.Matches(text);
foreach (Match match in r)