其实我是想用for循环将一个字符串数组的所有中文括号中的字符提取出来存到另一个数组,当然,最重要的是标题的问题,有请大佬表演

解决方案 »

  1.   


    string ch="fdsfdsa(fds)dsfds";
    MatchesSection(ch,false);
    public static List<string> MatchesSection(string ch,bool isInclude)
            {
                string strRegex = isInclude? @"(\([^\)]*\))": @"(?<=\()[^\)]+";//
                MatchCollection Matches = Regex.Matches(ch, strRegex, RegexOptions.IgnoreCase);
                List<string> str = new List<string>();
                foreach (Match NextMatch in Matches)
                {
                    str.Add(NextMatch.Value);
                }            return str;
            }https://blog.csdn.net/u013010499/article/details/103250879