本帖最后由 chen276675678 于 2012-08-28 16:13:41 编辑

解决方案 »

  1.   


                string source = "xxx.com xxxx.com xxxx.cc";
                Regex reg = new Regex(@"[\S]{3,4}.[\S]+");
                MatchCollection mc = reg.Matches(source);
                foreach (Match m in mc)
                {
                    MessageBox.Show(m.Value);
                }
      

  2.   

    按位数提取
    int num=4;//定义位数
                    string pattern_domain = string.Format(@"(?i)(?<=^|\s)\S{{{0}}}\.com(\.cn)?",num);
                    string[] temp_arr = Regex.Matches(domains, pattern_domain).Cast<Match>().Select(a => a.Value).ToArray();