我想按以下方式替換頁面的鏈接位置(錨標記)。替換鏈接位置(href ='...')
樣品輸入:
text text text <a href='http://test1.com/'> click </a> text text
other text <a class='links' href="gallery.html" title='Look at the gallery'> Gallery</a>
more text
樣本輸出
text text text <a href='http://example.com/p.php?q=http://test1.com/'> click </a> text text
other text <a class='links' href="http://example.com/p.php?q=gallery.html" title='Look at the gallery'> Gallery</a>
more text
我希望我說清楚。無論如何,我正在嘗試使用PHP和reg-ex來做到這一點。你能否正確地點亮我?
謝謝 薩迪
有些人遇到問題時會想:「我知道,我會用正則表達式。」現在他們有兩個問題。 – icktoofay 2010-06-23 05:46:20
@icktoofay除非你是Jay-Z有99個問題:P – alex 2010-06-23 06:05:12
如果你有更好的解決方案,然後reg-ex,請分享。我需要高效地解決問題。歡迎任何有效的解決方案。謝謝 – Sadi 2010-06-23 06:34:01