using System.Text.RegularExpressions;
public static void Main()
string input = "(aaa);(bbb)";
string pattern = @"\((.*?)\)";
MatchCollection matches = Regex.Matches(input, pattern);
Console.WriteLine("Matched Text: " + matches[0].Value);
Console.WriteLine("Extracted Text: " + matches[0].Groups[1].Value);
Console.WriteLine("Matched Text: " + matches[1].Value);
Console.WriteLine("Extracted Text: " + matches[1].Groups[1].Value);
Console.WriteLine("No match found.");