using System.Text.RegularExpressions;
public static void Main()
string input = "This is a sample string with vowels à é í ô û";
int totalVowels = CountVowels(input);
int totalVowelsWithoutAccent = CountVowelsWithoutAccent(input);
Console.WriteLine("Total vowels: " + totalVowels);
Console.WriteLine("Total vowels without accent: " + totalVowelsWithoutAccent);
static int CountVowels(string text)
string pattern = "[aeiouAEIOUàèìòùÀÈÌÒÙáéíóúÁÉÍÓÚâêîôûÂÊÎÔÛäëïöüÄËÏÖÜ]";
MatchCollection matches = Regex.Matches(text, pattern);
static int CountVowelsWithoutAccent(string text)
string pattern = "[aeiouAEIOU]";
MatchCollection matches = Regex.Matches(text, pattern);