变量 s可能有五种类型的值,每种类型可能有不同的操作!
(1)string s="return GetInfoID(@编号,"商品信息")";  函数型
(2)s=" out ID";  输出型
(3)s="-@数量 "; 或者 s="(@数量 + @金额)* @金额 " 四则运算
(4)s="asdf"; 或者s="1";或者s="默认值";   默认值型
(5)s="@你好";  参数型请问大家我怎么通过正则表达式,给定s的值,我就知道那种类型还有,怎样可以把 string aa=" Return GetValue("101","102")" 括号中的值取出!

解决方案 »

  1.   

    public static string fun=@"\breturn \S+(\S+)"; //函数
    public static string out1=@"out \S*"; //OUT
    public static string math="([+|-|*|/]+)([0-9]+)";//运算
    public static string default1=@"\S*"; //默认
    你的参数那个不太懂?有"@"标识吗?
      

  2.   

    string aa="Return GetValue(\"101\",\"102\")" ;//被取字符串
    int bb=aa.IndexOf('(');                       //括号开始索引
    string aa1=aa.Substring(bb+1,aa.Length-bb-2); //取括好内的字符串
    Console.WriteLine(aa1);