正则提取域名字符串的长度 本帖最后由 chen276675678 于 2012-08-28 16:13:41 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 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); } 按位数提取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(); 添加数据源时发生的未能获取列信息问题。 C#中的线程为何会被抢占? 求思路,网站与硬件交互 WebClient 的使用高级问题。高手请进!速度结 c# 如何向指定窗体发送消息?(windows api) DataTable 读入二维数组 将直线改变为虚线的方法? 我需要一为高人指导 急求asp.net(C#)导出Excel例子 关于字符串操作问题? c#动态调用带参数的DLL函数 自动生成序列号问题
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);
}
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();