html如下:
<table>
<tbody>
<tr><td><b>Colleague Name</b></td><td style="widtr: 150px"> </td><td><b>Modified Date</b></td></tr>
<tr><td>[$A0$] </td><td> </td><td>[$A1$] </td></tr>
</tbody>
</table>
<table>
<tbody>
<tr><td><b>Colleague Name</b> </td><td style="widtr: 150px"> </td><td><b>Modified Date</b> </td></tr>
<tr><td>[$B0$] </td><td> </td><td>[$B1$] </td></tr>
</tbody>
</table>
现在想用正则取出包含[$$]这种特殊的行(用C#正则),请高手帮帮忙.
运行下面代码:
string str = "<table><tbody><tr><td><b>Colleague Name</b></td><td style='widtr: 150px'> </td><td><b>Modified Date</b></td></tr><tr><td>[$A0$] </td><td> </td><td>[$A1$] </td></tr></tbody></table><table><tbody><tr><td><b>Colleague Name</b> </td><td style='widtr: 150px'> </td><td><b>Modified Date</b> </td></tr><tr><td>[$B0$] </td><td> </td><td>[$B1$] </td></tr></tbody></table>";
Regex regex = new Regex(@"<tr><td>\[\$\w+\$\] </td><td> </td><td>\[\$\w+\$\] </td></tr>", RegexOptions.Multiline | RegexOptions.IgnoreCase);
List<string> list = new List<string>();
foreach (Match match in regex.Matches(str))
{
if (match.Success)
list.Add(match.Value);
}
呵呵,刚刚做过,(<tr>\[\$\w+\$\]</tr>)?
SBM products:Raymond mill | vertical mill | ball mills | raymond mill | crushing equipment | mobile crusher | crushers | crusher in china