To match multiple A-label joins and name regular expressions
such as the source code
Knowledge Whipple News China Journal Network Dragon Source Journal Network Postal News Subscription Network magazine shop MBA think-tank Encyclopedia star Astronomy Network an exhortation net
Pastoral Astronomy Forum Patent Home Global Science Science Squirrel will UFO exploration network shell NET I study net NetEase open Class
Wikipedia I want to self-study network China Study Network to know the NetEase College search and ask beginners to learn the Internet National Nuclear Safety Bureau
Alas, I'm embarrassed
I asked this question recently, but there was a lot of good-hearted people who helped me out when there was only one a tag. Http://topic.csdn.net/u/20111216/16/934599d3-8e99-4b94-8dae-28e5b9c455c4.html
But now that it's multiple a-tag, I'm going to make a mistake.
Also please expert guidance. How should I get it?
------Solution--------------------
Preg_match_all ('/(. *)foreach ($matches [1] as $k = + $href) {
$arr [$matches [2][$k]] = $href;
}
Var_export ($arr);
/**
Output Result:
Array (' whipple info ' = ' http://www.cqvip.com/', ' Chinese journal net ' = ' http://www.chinaqking.com/', ' Dragon Source Journal ' www.qikan.com.cn/', ' Postal newspaper subscription network ' + ' Http://bk.183.com.cn/index.do ', ' Magazine shop ' + ' http://www.zazhipu.com/', ' MBA think tank Encyclopedia ' = ' http://wiki.mbalib.com/', ' star astronomy net ' = ' http://www.cosmoscape.com/', ' an exhortation net ' = ' http://www.quanxue.cn/', ' The Pastoral Astronomy Forum ' = ' http://www.astronomy.com.cn/bbs/', ' patent house ' = ' http://www.patent-cn.com/', ' Global science ' +/HTTP www.sciam.com.cn/', ' Science Squirrel will ' and ' http://songshuhui.net/', ' UFO discovery net ' = ' http://www.ufo-1.cn/', ' shell net ' = '/' www.guokr.com/', ' I learn the net ' and ' http://www.5xue.com/', ' netease open class ' = ' http://v.163.com/open/', ' wikipedia ' = '/' zh.wikipedia.org/', ' I want to self-study net ' and ' http://www.51zxw.net/', ' chinese study net ' = ' http://www.cscse.edu.cn/', ' Know ' and ' ' and ' http:/' /www.zhihu.com/', ' NetEase College ' and ' http://tech.163.com/school/video/', ' Search and ask ' and ' http://wenwen.soso.com/', ' novice learning online ' = > ' http://xue.baidu.com/', ' National Nuclear Safety Agency ' and ' http://nnsa.mep.gov.cn/',' Word alliance ' = ' http://www.wordlm.com/', ' love to ask knowledge people ' = ' http://iask.sina.com.cn/', ' Chinese civilization net ' www.wenming.cn/',)
PS: Once achieved, there seems to be no way.
*/
------Solution--------------------
$str = ' Knowledge Whipple information China Journal Network Dragon Source Journal Network Postal News Subscription Network magazine shop MBA think-tank Encyclopedia star Astronomy Network an exhortation net
Pastoral Astronomy Forum Patent Home Global Science Science Squirrel will UFO exploration network shell NET I study net NetEase open Class
Wikipedia I want to self-study network China Study Network to know the NetEase College search and ask beginners to learn the Internet National Nuclear Safety Bureau
Word Alliance love to ask Knowledge people Chinese civilization network ';
$patten = '/(. *) <\/a>/iu ';
Preg_match_all ($patten, $str, $match);
$result = Array ();