【发布时间】:2017-11-25 23:17:56
【问题描述】:
我有下面两个html的例子-
<a href="http://foo.com">User</a>: <a style="color:#333" href="http://foo.com/word"></a> blue elephant ·
<a href="http://foo.com">User</a>: <a style="color:#333" href="http://foo.com/word">@<b>word</b></a> blue elephant ·
我正在尝试使用 C# 解析它以放入 csv 文件,并且它在一定程度上可以工作,但是,当 html 中包含“@”符号时,它会将 csv 单元格留空或不包含前面带有“@”的单词。我想要得到的主要部分是@word blue elephant,但这会带回一个空白单元格,而第一个html示例会根据需要带回blue elephant。
我正在使用以下技术来做到这一点-
string[] comm = System.Text.RegularExpressions.Regex.Split(content[1], "<a");
如何更改它以适用于第二个 html 示例?
【问题讨论】: