如何检索出如下的几个变量?
一段Html代码
<table>
<tr> <td id=$31> asdfasdf </td> </tr>
<tr> <td id=$32> </td> dasdfasdf </tr>
<tr> <td id=$37> </td> asdf </tr>
<tr> <td id=$45> </td> sdaf </tr>
......
</table>
如何检索出还有变量$的结果 想实现这样的功能 $31,$32,$37,$45输出来就可以了
------解决方案--------------------正则:\$\d+
------解决方案--------------------正则表达式取 <td id=***> 的数组
------解决方案--------------------try
string yourStr = ............;
MatchCollection mc = Regex.Matches(yourStr, @ " <td\s+id=(\$\d+)> ", RegexOptions.IgnoreCase);
foreach (Match m in mc)
{
richTextBox2.Text += m.Groups[1].Value + "\n ";
}