a=string.indexof("(")
b=string.lastindexof(")")
string.substring(a-1,b-a)

解决方案 »

  1.   

    icehawk(我是一只小小鸟)
       我不是要查询子字符串,我是要写这样的正则表达式
      

  2.   

    string cutText = "已知的字符串";
    System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"\((?<str>[\w\(\)]+)\)+");
    System.Text.RegularExpressions.Match match  = regex.Match(cutText);
    if(match.Success)
    {
    MessageBox.Show(match.Groups["str"].Value);
    }
      

  3.   

    谢谢  showtimenow(景)你的解答还是没有解决我的问题我想正则表达式也不是万能的,他并不能实现动态匹配
      

  4.   

    看看这样是你的要求吗?
    string cutText = this.textBox1.Text;
    System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"\((?<str>.*)\)+");
    System.Text.RegularExpressions.Match match  = regex.Match(cutText);
    if(match.Success)
    {
    MessageBox.Show(match.Groups["str"].Value);
    }
      

  5.   

    把每一个(xxx)取出来,然后地规调用
      

  6.   

    TO:  qianli918(千里马)其实也不是要实现什么,我只是想看看 正则表达式是否有这样的功能
      

  7.   

    showtimenow(景)匹配出来的有严重问题
    如:abcd(4348743747))
    结果是:4348743747)
    应该是:4348743747