using System;
using System.IO;
using System.Text.RegularExpressions;
public class Test
{
public static void Main()
{
var line = "[A] == [B] * 10 - FUNCTION([C], STRING_EXPRESSION, FUNCTION([D],[C],[E])), FUNCTION([C], [X]), 100";
var matches = Regex.Matches(line, @"(?:(?:\((?>[^()]+|\((?<number>)|\)(?<-number>))*(?(number)(?!))\))|[^,])+");
foreach (Match m in matches)
Console.WriteLine(m.Value.Trim());
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uSU87CnVzaW5nIFN5c3RlbS5UZXh0LlJlZ3VsYXJFeHByZXNzaW9uczsKCnB1YmxpYyBjbGFzcyBUZXN0CnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBNYWluKCkKCXsKCQl2YXIgbGluZSA9ICJbQV0gPT0gW0JdICogMTAgLSBGVU5DVElPTihbQ10sIFNUUklOR19FWFBSRVNTSU9OLCBGVU5DVElPTihbRF0sW0NdLFtFXSkpLCBGVU5DVElPTihbQ10sIFtYXSksIDEwMCI7CiAgICAgICAgdmFyIG1hdGNoZXMgPSBSZWdleC5NYXRjaGVzKGxpbmUsIEAiKD86KD86XCgoPz5bXigpXSt8XCgoPzxudW1iZXI+KXxcKSg/PC1udW1iZXI+KSkqKD8obnVtYmVyKSg/ISkpXCkpfFteLF0pKyIpOwogICAgICAgIGZvcmVhY2ggKE1hdGNoIG0gaW4gbWF0Y2hlcykKICAgICAgICAJQ29uc29sZS5Xcml0ZUxpbmUobS5WYWx1ZS5UcmltKCkpOwogICAgICAgIAoJfQp9