[請益] 正規表示法
假如我要抓下面網頁中的藝術文化 導覽 活動 攝影...\等tag
請問用正規法要怎麼寫呢??
我怎麼寫都錯誤@@"""
<font class=mbody><a href="" rel="nofollow">http://tw.dir.yahoo.com/Art/"><b>藝術文化</b></a>
</font><br>
<a href="" rel="nofollow">http://tw.dir.yahoo.com/art/Guidelines/">導覽</a>, <a href=
"" rel="nofollow">http://tw.dir.yahoo.com/art/Activities/">活動</a>, <a href=
"" rel="nofollow">http://tw.dir.yahoo.com/art/classification/Photography/">攝影</a>,
<a href="" rel="nofollow">http://tw.dir.yahoo.com/art/classification/music/Singers/">
歌手歌星</a><br>
<a href="" rel="nofollow">http://tw.dir.yahoo.com/art/Comments/">評論</a>, <a href="http:
//tw.dir.yahoo.com/art/classification/Painting/">繪畫</a>, <a href="http:
//tw.dir.yahoo.com/art/classification/design_arts/Construction/">建築</a>,&nbs
p;<a href="" rel="nofollow">http://tw.dir.yahoo.com/art/classification/Traditional_Art/">傳統藝
術</a>
以下是我寫的....
<?
$str = file_get_contents("http://tw.dir.yahoo.com/");
preg_match("<a href="*/s"," rel="nofollow">http://*">*</a>/s", $str, $matches);
echo $matches[1];
?>
可是這樣好像不太對@@a
有爬文了可是還是不知道怎麼寫...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.129.161.41
→
05/17 21:21, , 1F
05/17 21:21, 1F
→
05/17 21:22, , 2F
05/17 21:22, 2F
→
05/17 21:22, , 3F
05/17 21:22, 3F
→
05/17 21:23, , 4F
05/17 21:23, 4F
→
05/17 22:21, , 5F
05/17 22:21, 5F
→
05/17 22:28, , 6F
05/17 22:28, 6F
推
05/17 22:41, , 7F
05/17 22:41, 7F
→
05/17 22:52, , 8F
05/17 22:52, 8F
討論串 (同標題文章)
PHP 近期熱門文章
PTT數位生活區 即時熱門文章
4
20
6
17