Solutions for finding and matching multiple a tag connections and name regular expressions

Source: Internet
Author: User
Find and match multiple a tag connections and name regular expressions such as the source code HTMLcode & lt; tdwidth & quot; 95% & quot; class & quot; tdW & quot; colspan & quot; 2 & quot; & gt; & lt; divclasstdL & gt; knowledge & lt; div & gt; & lt; ahref & quot; www. find and match multiple a tag connections and name regular expressions
Such as source code

HTML code
  

Knowledge

WIP News China journal network Longyuan Journal network postal newspapers and periodicals subscription network Zhupu MBA Think Tank Encyclopedia star astronomy network
MAF astronomical forum patent home world science squirrel will UFO Exploration Network fruit shell network I Learning Network NetEase Open course
Wikipedia I want to learn from myself. China study abroad. net knowledge. NetEase College. Souso. ask new students to learn online. National Nuclear Security Administration
Word Alliance: Chinese Civilization Network


Sorry,

I asked this question not long ago, but when there was only one a tag, there were a lot of good people who helped me solve it. Http://topic.csdn.net/u/20111216/16/934599d3-8e99-4b94-8dae-28e5b9c455c4.html
However, when there are multiple A tags, I cannot change them.
Please give me some advice. What should I do.



------ Solution --------------------
PHP code
Preg_match_all ('/(.*)$ Href) {$ arr [$ matches [2] [$ k] = $ href;} var_export ($ arr);/** output result: array ('vipinfo '=>' http://www.cqvip.com/ ', 'Chinese Journal net' =>' http://www.chinaqking.com/ ', 'Longyuan Journal net' =>' http://www.qikan.com.cn/ ', 'Postal newspaper subscription net' =>' http://bk.183.com.cn/index.do ', 'Wonpu' =>' http://www.zazhipu.com/ ', 'MBA Think Tank Encyclopedia' =>' http://wiki.mbalib.com/ ', 'Skynet' =>' http://www.cosmoscape.com/ ', 'Study abroad net' =>' http://www.quanxue.cn/ ', 'Mafu astronomical BBS' =>' http://www.astronomy.com.cn/bbs/ ', 'Patent home' =>' http://www.patent-cn.com/ ', 'Global Scientific' =>' http://www.sciam.com.cn/ ', 'Science squirrel' =>' http://songshuhui.net/ ', 'UFO exploration net' =>' http://www.ufo-1.cn/ ', 'Shell net' =>' http://www.guokr.com/ ', 'Learning from net' =>' http://www.5xue.com/ ', 'Netease open class' =>' http://v.163.com/open/ ', 'Wikipedia' =>' http://zh.wikipedia.org/ ',' I want to learn about net' =>' http://www.51zxw.net/ ', 'China study abroad net' =>' http://www.cscse.edu.cn/ ', 'Zhihu' =>' http://www.zhihu.com/ ', 'Netease '=>' http://tech.163.com/school/video/ ', 'Search and query' =>' http://wenwen.soso.com/ ', 'Newbie learns to surf the Internet' =>' http://xue.baidu.com/ ', 'National Nuclear Security Authority' =>' http://nnsa.mep.gov.cn/ ', 'Word consortium' =>' http://www.wordlm.com/ ', 'Love question knowledgeable' =>' http://iask.sina.com.cn/ ', 'Chinese civilization net' =>' http://www.wenming.cn/ ',) // PS: once reached, it seems that there is no way. */
------ Solution --------------------
PHP code
    

Knowledge

WIP News China journal network Longyuan Journal network postal newspapers and periodicals subscription network Zhupu MBA Think Tank Encyclopedia star astronomy network
MAF astronomical forum patent home world science squirrel will UFO Exploration Network fruit shell network I Learning Network NetEase Open course
Wikipedia I want to learn from myself. China study abroad. net knowledge. NetEase College. Souso. ask new students to learn online. National Nuclear Security Administration
Word Alliance: Chinese Civilization Network'; $ Patten = '/(. *) <\/a>/iU '; preg_match_all ($ patten, $ str, $ match); $ result = array (); for ($ I = 0; $ I "; Print_r ($ result);?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.