<a href="http://china.alibaba.com/member/profile.htm?member_id=参数" target=_blank class="uol" >梁俊松</a>
      
      先生这样一段html标记  变的内容为 参数部分和人名部分 还有先生(称呼)部分 我想用正则匹配得到人名和称呼 如何得到 很急 多谢高手!

解决方案 »

  1.   

      只得到汉字?try
    ^[\u4e00-\u9fa5]+$
      

  2.   

    try...Match m = Regex.Match(yourStr, @"<a\s+href=""http://china\.alibaba\.com/member/profile\.htm\?member_id=(?<id>[^""]+)""\s+target=_blank\s+class=""uol""\s*>(?<name>(?:(?!</a>).)*)</a>\s*(?<app>\S+)");
    if (m.Success)
    {
        richTextBox2.Text += m.Groups["id"].Value + "\n";
        richTextBox2.Text += m.Groups["name"].Value + "\n";
        richTextBox2.Text += m.Groups["app"].Value + "\n";
    }
      

  3.   

     string webDocContent="<a href=http://www.xxx.xxx/college/pages/default.htm target=_blank>文字</A>";
     
                string strPattern=@"a[\s]+href=(?<Link>[^\s>]+)[^>]*>(?<Text>[^<]*)</a>";
                MatchCollection Matches=Regex.Matches(webDocContent,strPattern,RegexOptions.IgnoreCase|RegexOptions.Compiled);
                foreach(Match NextMatch in Matches)
                {
                    string URL=NextMatch.Groups["Link"].Value.ToString().Trim();
                    string URLText=NextMatch.Groups["Text"].Value.ToString().Trim();            }            string strPageContent = string.Empty;
                StreamReader srPage = new StreamReader(@"e:\save.txt",System.Text.Encoding.GetEncoding("gb2312"));
                strPageContent = srPage.ReadToEnd();
                srPage.Close();
                  MatchCollection TitleMatchs = Regex.Matches(strPageContent, "<td>((\\s)*(.*?)(\\s)*(.*?)(\\s)*(.*?)(\\s)*(.*?)(\\s)*)</td>", RegexOptions.IgnoreCase | RegexOptions.Multiline );
                foreach(Match NextMatch in TitleMatchs)
                {
                    Label1.Text +=  NextMatch.Groups[1].Value;
                }