string str="M:Customer.Logic.GetUsersData(Entity.User,System.Int)"
string newStr[]=new string[2];
规则:
newStr[0]:取最后一个括号前到点的值(例:GetUsersData) //最后一个括号可能不存在.即:M:Customer.Logic.GetUsersData
newStr[1]:如果存在最后一个括号,则取其中的值(例:User Int),不存在则放空 //括号中的参数数量可能不一致

解决方案 »

  1.   

    (?:[^.()]+\.)+(?<v>[^\(.]+)(?:\(([^.]+\.[^.,]+,)+[^.]+\.([^.)]+)\))?
      

  2.   


    void Main()
    {
    string str="M:Customer.Logic.GetUsersData(Entity.User,System.Int)";
          List<string> newStr=new List<string>();
        Regex reg= new  Regex(@"(?:[^.()]+\.)+(?<v>[^\(.]+)(?:\(([^.]+\.([^.,]+),)+[^.]+\.([^.)]+)\))?");
    newStr.Add(reg.Match(str).Groups["v"].Value);
    reg.Match(str).Groups[2].Captures.Cast<Capture>()
    .Concat(reg.Match(str).Groups[3].Captures.Cast<Capture>())
    .Select(c=>c.Value).ToList().ForEach(c=>newStr.Add(c));
     
    Console.WriteLine(newStr.ToArray());
    }
      

  3.   

    Regex reg= new  Regex(@"(?:[^.()]+\.)+(?<v>[^\(.]+)(?:\(([^.]+\.([^.,]+),)+[^.]+\.([^.)]+)\))?");
    ========================================== 
    Regex reg= new  Regex(@"(?:[^.()]+\.)+(?<v>[^\(.]+)(?:\(([^.]+\.([^.,]+),)*[^.]+\.([^.)]+)\))?");