这样写正则对吗? 第一个Regex r = new Regex(@"<li style=" + "width:200px; margin-top:21px;>.+</div>");第二个Regex r = new Regex(@"<div class="+"task-list-cen1>.+</div>"); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参数类型是 string所以当然可以这样写 string 拼接最后还是string 但是Regex r = new Regex(@"<div class="+"task-list-cen1>.+</div>"); MatchCollection mc = r.Matches(tblb);mc.count却为0,应该为20才对的,是什么原因呢 Regex r1 = new Regex(Regex.Escape(@"<div class=")+Regex.Escape("task-list-cen1>.+</div>"));帖你的数据来看看 第一个<li style="width:200px; margin-top:21px;">第二个<div class="task-list-cen1 task-list-cen2"> <div class="task-list-cen1 task-list-cen2"> <ul class="clearfix"> <li style="width:26px; margin-top:28px;"></li> <li style="width:200px; margin-top:21px;"> <p style="font-size:12px; font-weight:bold;">2011</p> </li> </ul> </div> 你的表达式中根本就没有匹配双引号啊:第一个Regex r = new Regex(@"<li style=""" + "width:200px; margin-top:21px;"">.+</div>");第二个Regex r = new Regex(@"<div class="""+"task-list-cen1"">.+</div>"); 恩恩,不过怎么提示括号,没看出还哪里有问题Regex r = new Regex(@"<li style=""" + "width:200px; margin-top:21px;"">.+</div>");错误 1 应输入 ) G:\Projects\abc\test\GueForm.cs 295 82 错误 2 应输入 ; G:\Projects\abc\test\GueForm.cs 295 93 错误 3 无效的表达式项“)” G:\Projects\abc\test\GueForm.cs 295 93怎么不能上传本地图片 - -! CSDN不能上传本地图片,随便找了个贴吧上传的图片。 一个有些难度的问题,求解 新手 求指点 C#的char[]的使用和定义 登陆异常问题,100分求教 求ASP问题 关于论坛浏览帖子 如何将窗体中的变量值传递到水晶报表的字段中?(急~~~) 超出打开游标最大数怎么解决? 如何在外部类中截获某窗体的消息? C#转换为VB.Net的问题,似乎VB.Net无法实现,救命啊!!! imageList的初始化,3个小问题 关于动易的一个问题,请大侠们帮帮忙,后天要交! 奇怪,程序在开机第一次运行时报错:ORA-01008 并非所有变量都已关联
所以当然可以这样写 string 拼接最后还是string
Regex r = new Regex(@"<div class="+"task-list-cen1>.+</div>");
MatchCollection mc = r.Matches(tblb);mc.count却为0,应该为20才对的,是什么原因呢
<li style="width:200px; margin-top:21px;">第二个
<div class="task-list-cen1 task-list-cen2">
<ul class="clearfix">
<li style="width:26px; margin-top:28px;"></li>
<li style="width:200px; margin-top:21px;">
<p style="font-size:12px; font-weight:bold;">2011</p>
</li>
</ul>
</div>
Regex r = new Regex(@"<li style=""" + "width:200px; margin-top:21px;"">.+</div>");错误 1 应输入 ) G:\Projects\abc\test\GueForm.cs 295 82
错误 2 应输入 ; G:\Projects\abc\test\GueForm.cs 295 93
错误 3 无效的表达式项“)” G:\Projects\abc\test\GueForm.cs 295 93怎么不能上传本地图片 - -!