我有一個像博客數據:我想過濾出我的博客文章中的foregin鏈接,有人能幫我正則表達式嗎?
This is foreign <a href="xyz.com">link</a>, this is my site's <a href="mysite.com">link</a> and so on.
我想是做的是過濾國外網站的鏈接,即「<a href="xyz.com">link</a>
」。所以我的最終輸出是:
This is foreign link, this is my site's <a href="mysite.com">link</a> and so on.
我試過「preg_replace」,但沒有任何模式的幫助。
我建議你閱讀這個答案:http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 – 2010-02-05 18:21:43
感謝分享這個,你能建議任何其他方式來做到這一點? – 2010-02-05 18:49:20