大概这样string html = ".....";Regex re = new Regex(@"<tr class=""[^""]+""[^>]*>\s*<td[^>]*>\s*<a[^>]*>\s*<acronym[^>]*>(?<cur>.*?)<.*?</td[^>]*>\s*<td[^>]*>(?<down>.*?)<.*?<td[^>]*>(?<numx>.*?)<.*?<td[^>]*>(?<numy>.*?)<", RegexOptions.Compiled|RegexOptions.IgnoreCase|RegexOptions.Singleline);
foreach(Match m in re.Matches(html))
{
Console.WriteLine("currency={0}, down={1}, whatever={2}, whatever2={3}",
m.Groups["cur"].Value,
m.Groups["down"].Value,
m.Groups["numx"].Value,
m.Groups["numy"].Value);
}
CSDN现在好像会在>前面加空格(很糟),所以你也许需要修改上面的正则
foreach(Match m in re.Matches(html))
{
Console.WriteLine("currency={0}, down={1}, whatever={2}, whatever2={3}",
m.Groups["cur"].Value,
m.Groups["down"].Value,
m.Groups["numx"].Value,
m.Groups["numy"].Value);
}
CSDN现在好像会在>前面加空格(很糟),所以你也许需要修改上面的正则
--------------------
我汗,思归那里可能才吃过晚饭吧string test = @"<tr class=""first EUR"">
<td class=""mynt"" scope=""row""><a href=""/adir/gengigjaldmidla/gengisthroun/?mynt=EUR&teg=A""><acronym title=""Evra"">EUR </acronym></a></td>
<td class=""neg"">-0,30<img alt=""Down"" src=""/themes/default/img/arrow_down.gif"" /></td>
<td>85,19</td>
<td>85,71</td>
</tr> ";MatchCollection mc = Regex.Matches(test, @"(?<=<td[^>]*>)[\s\S]*?(?=</td>)", RegexOptions.IgnoreCase);
if (mc.Count > 0)
{
for (int i = 1; i < mc.Count; i++)
{
richTextBox1.Text += Regex.Replace(mc[i].Value, "<[^>]*>", "") + "\n";
}
}