fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. string msg= "(ed) (Karlsruhe Univ. (TH) (Germany, F.R.))";
  8. var charSetOccurences = new Regex(@"\(((?:[^()]|(?<o>\()|(?<-o>\)))+(?(o)(?!)))\)");
  9. var charSetMatches = charSetOccurences.Matches(msg);
  10. foreach (Match match in charSetMatches)
  11. {
  12. Console.WriteLine(match.Groups[1].Value);
  13. }
  14. }
  15. }
Success #stdin #stdout 0.08s 34040KB
stdin
Standard input is empty
stdout
ed
Karlsruhe Univ. (TH) (Germany, F.R.)