下面html需要一次分析出
标题(去html代码):表现良好!马自达3 C-NCAP碰撞实验完成
链接:http://www.autohome.com.cn/news/200802/34367.html
日期:2008-2-26 13:35
来源:汽车之家<span>&#8226;&nbsp;<a href=http://www.autohome.com.cn/news/200802/34367.html name="_t" rel="&a=5&pn=1"  target=_blank>表现良好!<font color="#C60A00">马自达</font>3 C-NCAP碰撞实验完成</a>&nbsp;<font class=g size=1>汽车之家 2008-2-26 13:35</font><br></span>

解决方案 »

  1.   


    (?<=href=)http.*?\s|(?<=>)[^&]*?(?=<)
    匹配结果http://www.autohome.com.cn/news/200802/34367.html 
    表现良好!
    马自达
    3 C-NCAP碰撞实验完成
    汽车之家 2008-2-26 13:35
      

  2.   


     <a href=(?<urlText>)\S+[\s\S]+?>(?<title1>)[^>]+<font[^>]+>(?<title2>)[^>]+</font>(?<title3>)[^>]+</a>([\S]+)?<font[^>]+>((?<sourceText>)\W+)((?<time>)\S+\s+[\S]+)(?=</font>)
      

  3.   

    try:string strReg = "(.*)?<a\\s(?<url>[^\\s]*).*target=_blank>(?<title1>[^<]*)<.*>(?<title2>[^<]*)</font>(?<title3>[^<]*).*size=1>(?<source>[^\\s]*)\\s(?<time>[^<]*)<";
                MatchCollection matchCollection = Regex.Matches( strInput, strReg, RegexOptions.Multiline );
                foreach ( Match ma in matchCollection )
                {
                    Console.WriteLine( "链接:" + ma.Groups["url"] );
                    Console.WriteLine( "标题:"+ ma.Groups["title1"].Value + ma.Groups["title2"].Value + ma.Groups["title3"].Value );
                    Console.WriteLine("来源:"+ ma.Groups["source"] );
                    Console.WriteLine( "日期:"+ma.Groups["time"]);
                } 好久没写了..
      

  4.   


    string text=".....";
    string regMath = @"<a href=(?<urlText>)\S+[\s\S]+?>(?<title1>)[^>]+<font[^>]+>(?<title2>)[^>]+</font>(?<title3>)[^>]+</a>([\S]+)?<font[^>]+>((?   <sourceText>)\W+)((?<time>)\S+\s+[\S]+)(?=\\<\\/font\\>)";
    Match mc = Regex.Match(text, regMath);
    if (mc.Success)
      {
        string title=mc.group["title1"].ToString()+mc.group["title2"].ToString()+mc.group["title3"].ToString();
        string link=mc.group["urlText"].ToString();
        string source=mc.group["sourceText"].ToString();
        string time=mc.group["time"].ToString();
      }
      

  5.   

    老兄你的代码没经过测试啊,先不说group写错了,就是表达式也错了
    正在分析“<a href=(?<urlText>)\S+[\s\S]+?>(?<title1>)[^>]+<font[^>]+>(?<title2>)[^>]+</font>(?<title3>)[^>]+</a>([\S]+)?<font[^>]+>((?   <sourceText>)\W+)((?<time>)\S+\s+[\S]+)(?=\\<\\/font\\>)”- 无法识别的分组构造。
      

  6.   

    我的测试过,将strInput赋值为要匹配的字符串
    如果你要处理的数据格式是形如你给出的示例字符串,是可以正确匹配出的
    如果有出入还请搂主指出
      

  7.   

    sbqcel 的代码成功了 thank you