注册 登录
编程论坛 ASP.NET技术论坛

按网上的例子,但怎么匹配不成功的呢

liaohongchu 发布于 2011-04-13 09:05, 472 次点击
string text = "I'vefoundthisamazingURLathttp://www.,andthenfindftp://ftp.
            string pattern = @"b(?<protocol>S+)://(?<address>S+)b";
            MatchCollection mc = Regex.Matches(text,pattern);
            Response.Write("文本中包含的URL地址有:");
            foreach(Match match in mc)
            {
                GroupCollection gc = match.Groups;
                string outputText = "URL:" + match.Value + ";Protocol:" + gc["protocol"].Value + ";Address:" + gc["address"].Value;
                Response.Write(outputText);
            }

都没有匹配到,为空, 哪里不对了
0 回复
1