获取2个html标签之间的文本c#

2023-12-27

我试图获取提供的 html(span)之间的数据(在本例中为 31)

这是原始代码(来自 Chrome 中的检查元素)

<span id="point_total" class="tooltip" oldtitle="Note: If the number is black, your points are actually a little bit negative.  Don't worry, this just means you need to start subbing again." aria-describedby="ui-tooltip-0">31</span>

我有一个包含页面源代码的富文本框,这里是相同的代码,但位于富文本框的第 51 行:

<DIV id=point_display>You have<BR><SPAN id=point_total class=tooltip jQuery16207621750175125325="23" oldtitle="Note: If the number is black, your points are actually a little bit negative.  Don't worry, this just means you need to start subbing again.">17</SPAN><BR>Points </DIV><IMG style="FLOAT: right" title="Gain subscribers" border=0 alt="When people subscribe to you, you lose a point" src="http://static.subxcess.com/images/page/decoration/remove-1-point.png"> </DIV>

我该怎么做呢?我尝试了几种方法,但似乎没有一个对我有用。

我正在尝试从此页面检索点值:http://www.subxcess.com/sub4sub.php http://www.subxcess.com/sub4sub.php这个数字会根据替补你的人而变化。


你可能对此非常具体:

var regex = new Regex(@"<span id=""point_total"" class=""tooltip"" oldtitle="".*?"" aria-describedby=""ui-tooltip-0"">(.*?)</span>");

var match = regex.Match(@"<span id=""point_total"" class=""tooltip"" oldtitle=""Note: If the number is black, your points are actually a little bit negative.  Don't worry, this just means you need to start subbing again."" aria-describedby=""ui-tooltip-0"">31</span>");

var result = match.Groups[1].Value;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

获取2个html标签之间的文本c# 的相关文章