c# 利用正则表达式 提取html中数据 15

比如在<tr><tdcolspan="3"style="background-color:#F7FAFF;height:36px;line-height:20px;"><... 比如在<tr><td colspan="3" style="background-color:#F7FAFF; height: 36px; line-height:20px; "><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td width="75%"><strong style="font-size: 14px">北京分享天下科技有限公司</strong>

中,通过
<strong style="font-size:14px">{[^<]+}<
提取公司名称,在c#中该如何操作啊?我把正则表达式放入一个字符串中,用转移字符处理了两个双引号的问题,但是不能找到数据了啊!急!!!!
展开
 我来答
wangpaishi
2013-11-06 · TA获得超过570个赞
知道小有建树答主
回答量:932
采纳率:52%
帮助的人:746万
展开全部
Macth m = Regex.Match(html, "<strong style=\"font-size: 14px\">(?<CompanyName>.*?)</strong>", ...);
if (m.Success)
{
    string companyName = m.Group["CompanyName"].Value;
}


lirimalu
2013-11-06 · 超过11用户采纳过TA的回答
知道答主
回答量:20
采纳率:100%
帮助的人:25.2万
展开全部
            Match match = Regex.Match(str, "<strong\\s+style\\s*=\\s*\"font-size\\s*:\\s*14px\\s*\"\\s*>([^<]+)<");
            while (match.Success)
            {
                string value = match.Groups[1].Value;
                //do sth
                match = match.NextMatch();  //查找下一个匹配的公司名
            }
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式