原文:C#中使用正則表達式提取超鏈接地址的集中方法

一般在做爬蟲或者CMS的時候經常需要提取 href鏈接或者是src地址。此時可以使用正則表達式輕松完成。Regex reg new Regex is lt a gt href lt url gt s gt gt gt lt text gt : lt a b . lt a gt MatchCollection mc reg.Matches yourStr foreach Match m in mc ...

2014-07-29 15:04 2 3573 推薦指數:

查看詳情

微軟面試題:正則表達式提取鏈接地址

寫出正則表達式,從一個字符串中提取鏈接地址。比如下面字符串中 "IT面試題博客中包含很多 <a href=http://hi.baidu.com/mianshiti/blog/category/微軟面試題> 微軟面試題 </a> " 則需要提取地址為 " http ...

Sat Mar 24 05:59:00 CST 2012 0 3619
 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM