想把字符串中括号内包括括号字符删除,请问怎么做?

解决方案 »

  1.   

    try...string result = Regex.Replace(yourStr, @"\([^()]*\)", "");如果括号中有嵌套,需要用到平衡组
      

  2.   

         string strOld = @"abc(123)klo";
                string strNew = Regex.Replace(strOld , @"\([^)]*\)", "");
      

  3.   

    try..
     static void Main(string[] args)
                {
                    string yourStr = @"111(ssssssssssssss)ss";               
                    Console.WriteLine(Regex.Replace(yourStr, @"\([^)]*\)", ""));
                }