当前位置:首页
开发技术指南» 文章正文
    引言:

    摘要: 本人刚刚开始学习asp.net,被c#弄得一头雾水,在网上找到了这篇最全面的登录页面设计实例,便开始详细研究(详细下载地址:http://www.soft123.com/news/html/2005-06/200563204012.htm这里面有详细的代码可供下载)。也对实例中的数据库进行了模拟login.aspx文件基本测试通过,里面用到了登录的文本框:其中在isreguserok()函......
 ·求助今早在卫生间发生的事    »显示摘要«
    摘要: 早上方便,一低头,天,发现一条类似红蚯蚓的大长虫,挑起来,约15cm,周身红色,不透明, 顿感周身无力,头皮发麻, 问这是什么寄生虫,该如何治疗1 ......


求正则表达式

string   aa="<table><tr><td><a   href=1.hmt   target=_blank>链接1</a></td></tr>><tr><td><a   href=2.hmt>链接2</a></td></tr>......</table>"  
   
  我想取得链接和文本   放到一个二维数组里:  
  1.htm     链接1  
  2.htm     链接2  
  ............  
   
  请问如何实现?

NO.1   作者: dk385

<a[\s]+href=(?<Link>[^\s>]+)[^>]*>(?<Text>[^<]*)</a>  
  取Link和Text组.

NO.2   作者: luojinat2005

完整的控制太应用程序代码(已经通过测试):  
  ----------------------------------------  
  using   System;  
  using   System.Text.RegularExpressions;  
   
  public   class   RegularExpressions  
  {  
  static   void   Main()  
  {  
  string   strMy="<table><tr><td><a   href=1.hmt   target=_blank>链接1</a>"  
  +"</td></tr>><tr><td><a   href=2.hmt>链接2</a></td></tr>..</table>";  
  string[,]   arrMy=new   string[2,2];  
  string   strPattern=@"<a[\s]+href=(?<Link>[^\s>]+)[^>]*>(?<Text>[^<]*)</a>";  
  MatchCollection   Matches=Regex.Matches(strMy,  
  strPattern,  
  RegexOptions.IgnoreCase);  
  int   i=0;  
  foreach(Match   NextMatch   in   Matches)  
  {  
  arrMy[i,0]=NextMatch.Groups["Link"].Value.ToString();  
  arrMy[i,1]=NextMatch.Groups["Text"].Value.ToString();  
  Console.WriteLine("arrMy[{0},0]:{1}\narrMy[{2},1]:{3}",  
  i,arrMy[i,0],i,arrMy[i,1]);  
  i++;  
  }  
  Console.ReadLine();  
  }  
  }  
  ----------------------------------------------------------------------------------  
  可以揭帖了!


    摘要: 我编了一个比较小规模的java软件,可是别人用起来,总是一天要程序死掉一次或者二次,但是关闭任务,然后重启就没有问题了,而且每天都是这样,我知道我的垃圾回收可能有问题,但是有没有什么软件可以帮助我最快的找到那个变量没有及时释放而导致了程序很容易死机? ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE