1
請幫助我從這裏使用C#.net Regex Replace
方法替換所有額外的Facebook信息。Facebook的飼料 - 從錨點刪除額外的Facebook的JS
例
<a href="/l.php?u=http%3A%2F%2Fon.fb.me%2FOE6gnB&h=yAQFjL0pt&s=1" target="_blank" rel="nofollow nofollow" onmouseover="LinkshimAsyncLink.swap(this, "http:\/\/on.fb.me\/OE6gnB");" onclick="LinkshimAsyncLink.swap(this, "\/l.php?u=http\u00253A\u00252F\u00252Fon.fb.me\u00252FOE6gnB&h=yAQFjL0pt&s=1");">http://on.fb.me/OE6gnB</a>somehtml
輸出
somehtml <a href="http://on.fb.me/OE6gnB">on.fb.me/OE6gnB</a> somehtml
我試過以下的正則表達式,但他們並沒有爲我
searchPattern = "<a([.]*)?/l.php([.]*)?(\">)?([.]*)?(</a>)?";
replacePattern = "<a href=\"$3\" target=\"_blank\">$3</a>";
感謝
工作
http://stackoverflow.com/questions/701166/can-you-provide-some-examples-of-why-it-is-hard-to-parse-xml-and-html -with-a-reg 有幾個不同的庫可以去掉來自html/xml的數據之一是http://htmlagilitypack.codeplex.com/,爲什麼試圖重新發明輪子? – 2012-08-14 08:08:33