我有一些代碼的html文件是這樣的:提取字符串在C#中
<div style="border: 0px red solid; width: 633px; position: relative; margin: 0px;
float: right">
<font style="font-size: 8pt; color: Navy; font-weight: Bold;">Unit Name: </font>My Unit Name <font style="font-size: 8pt; color: Navy; font-weight: Bold;">
Manager: </font>My Manager Name <font style="font-size: 8pt;
color: Navy; font-weight: Bold;">Category: </font>My Category
</div>
<div style="border: 0px red solid; width: 122px; position: relative; margin: 0px;
padding: 0px;">
<button name="sSdewfwo87kjLKH7624QAZMLLPIdyt75576rtffTfdef22de" style="font-family: Tahoma;"
onclick="OpenMyWin2(1,843442,8445,'bf61fd588f00cbe7a37dab20c62e1c63')">
More Info</button></div>
我想提取的類別的前信息:&經理:&單位名稱:。我如何使用RegularExpression從大型html文件中提取這些文件。這些文件可能有100個相似的項目。
來處理這類任務的最佳方式是通過像[HTML敏捷性包(HTTP專用庫://htmlagilitypack.codeplex )// – Steve
用正則表達式解析HTML是一個禁忌。對於一個笑,閱讀[這](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags) –