我試圖讓所有的下列標記之間的文本,它只是不workind 正則表達式
If Not String.IsNullOrEmpty(_html) Then
Dim regex As Regex = New Regex(_
".*<entry(?<link>.+)</entry>", _
RegexOptions.IgnoreCase _
Or RegexOptions.CultureInvariant _
Or RegexOptions.Multiline _
)
Dim ms As MatchCollection = regex.Matches(_html)
Dim url As String = String.Empty
For Each m As Match In ms
url = m.Groups("link").Value
urls.Add(url)
Next
Return urls
我已經寫了我的獲取功能來獲取HTML作爲字符串。我一直在尋找的HTML敏捷包的例子,我沒有保存爲HTML文檔
HtmlDocument doc = new HtmlDocument();
doc.Load("file.htm");
foreach(HtmlNode link in doc.DocumentElement.SelectNodes("//a[@href"])
{
HtmlAttribute att = link["href"];
att.Value = FixLink(att);
}
doc.Save("file.htm");
Obligatory Obligatory:http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 – 2010-10-19 16:59:28
來自同一問題的另外兩個有價值的或翔實的答案: http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1733489#1733489 http://stackoverflow.com/questions/1732348/regex-match-open -tags-except-xhtml-self-contained-tags/1758162#1758162 – 2010-10-19 17:12:35
最後使用基本的XML parsing.XMLdocument – vbNewbie 2010-10-21 19:24:56