<A class="W_f14 S_func1" href="http://weibo.com/u/1950836865" target=_blank usercard="id=1950836865">公益魏豪</A> <SPAN class=addr><EM class="W_ico12 male"></EM>辽宁 大连 </SPAN>如何获取 usercard="id=1950836865中1950866865的值和”公益富豪“的值呢
求高手解答谢啦

解决方案 »

  1.   

    string pattern=@"(?i)<a[^>]*?href=[""']http://weibo\.com/u/(\d+)[""'][^>]*>([^<]*)</a>";
      

  2.   

    Match match = Regex.Match("a", "<A[\w\W]+?id=(\d+)">([\w\W]+?)</A>");
    string str1=match.group[1].value;
    string str2=match.group[2].value;
      

  3.   

    string input= <A class="W_f14 S_func1" href="http://weibo.com/u/1950836865" target=_blank usercard="id=1950836865">公益魏豪</A> <SPAN class=addr><EM class="W_ico12 male"></EM>辽宁 大连 </SPAN>;
    Match =Regex.Match(input,"<A class=.+usercard=\"([0-9]+)\">(\w+)</A>")
    value1 = Match.Groups[1].value
    value2 = Match.Groups[2].value
      

  4.   

    Match match = Regex.Match(string yourstr, "<A[\w\W]+?id=(\d+)">([\w\W]+?)</A>");
      

  5.   

    <A (class=\".+[^\"]\" )?href="http://weibo.com/u/(\d+)" target=_blank usercard=\"(.+[^\"])\" .+[^>]>(\w+[^<])</A>
      

  6.   

    Group[1]是1950866865
    Group[2]是公益富豪