Find and match multiple a tag connections and name regular expressions This post was last edited by xiachao2008 at 2011-12-1916: 04: 25, such as the source code & lt; td & nbsp; & nbsp; colspan2 & nbsp; & gt; & lt; div & nbsp; classtdL & gt; the regular expression that matches multiple a tag connections and names
This post was last edited by xiachao2008 at 16:04:25, 2011-12-19
Such as source 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 --------------------
Preg_match_all ('/(.*)Foreach ($ matches [1] as $ k => $ 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/ ',)