fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text.RegularExpressions;
  6.  
  7. public class Test
  8. {
  9. public static void Main()
  10. {
  11. var arg = @"(?>\w*\((?>[^()]+|(?<o>)\(|(?<-o>)\))*(?(o)(?!))\)|\w+)";
  12. var pattern = $@"^\s*(concat)\(\s*({arg})\s*,\s*({arg})\)\s*$";
  13. var match = Regex.Match("concat(regex(3,4),regex(3,4))", pattern);
  14. if (match.Success)
  15. {
  16. Console.WriteLine(match.Groups[1].Value);
  17. Console.WriteLine(match.Groups[2].Value);
  18. Console.WriteLine(match.Groups[3].Value);
  19. }
  20. }
  21. }
Success #stdin #stdout 0.07s 21424KB
stdin
Standard input is empty
stdout
concat
regex(3,4)
regex(3,4)