using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
public class Test
{
public static void Main()
{
var str = "something, 'foo', something ('bar')";
var result = Regex.Matches(str, @"\([^()]*\)|'([^']*)'")
.Cast<Match>()
.Select(m => m.Groups[1].Value)
.ToList();
foreach (var s in result)
Console.WriteLine(s);
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLklPOwp1c2luZyBTeXN0ZW0uTGlucTsKdXNpbmcgU3lzdGVtLlRleHQuUmVndWxhckV4cHJlc3Npb25zOwoKcHVibGljIGNsYXNzIFRlc3QKewoJcHVibGljIHN0YXRpYyB2b2lkIE1haW4oKQoJewoJCXZhciBzdHIgPSAic29tZXRoaW5nLCAnZm9vJywgc29tZXRoaW5nICgnYmFyJykiOwogICAgCXZhciByZXN1bHQgPSBSZWdleC5NYXRjaGVzKHN0ciwgQCJcKFteKCldKlwpfCcoW14nXSopJyIpCgkgICAgCS5DYXN0PE1hdGNoPigpCgkgICAgCS5TZWxlY3QobSA9PiBtLkdyb3Vwc1sxXS5WYWx1ZSkKCSAgICAJLlRvTGlzdCgpOwogICAgICAgIGZvcmVhY2ggKHZhciBzIGluIHJlc3VsdCkKICAgICAgICAJQ29uc29sZS5Xcml0ZUxpbmUocyk7Cgl9Cn0=