0
我有一些问题与匹配的文本从HTML页面提取数据。这里是我到目前为止,但plainText
保持为空:c#Regex.Match问题
private void Scrape()
{
// create variables
string html;
string plainText;
// download page source
// sample URL: http://freekeywords.wordtracker.com/?seed=test&adult_filter=remove_offensive&suggest=Hit+Me";
html = webBrowser1.Document.Body.InnerText;
// scrape keywords
plainText = Regex.Match(html, @"class='k'[^x]display: none""", RegexOptions.IgnoreCase).Groups[1].Value;
//plainText = Regex.Replace(plainText, @"\,", Environment.NewLine);
//plainText = Regex.Replace(plainText, @"""", "");
this.richTextBox1.Text = html;
}
是否有充分的理由使用正则表达式来解析HTML而不是使用HTML解析器? –