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 pattern = @"\bisnull\((?>[^][()]|(?<x>\[[^][]*])|(?<o>)\(|(?<-o>)\))*(?(o)(?!))\)";
  12. var text = "isnull(Num([abc]), [a], [b]) + sum([d])";
  13. var result = Regex.Match(text, pattern, RegexOptions.IgnoreCase)?.Groups["x"].Captures;
  14. Console.WriteLine(string.Join(", ", result));
  15. }
  16. }
Success #stdin #stdout 0.08s 21104KB
stdin
Standard input is empty
stdout
[abc], [a], [b]