要提取一个网页下面的部分:href="http://www.sdfg.com/brands/655-2182.html"。其中655-2182的数字部分是可变的,
要求:匹配上面的所有部分,但只返回2182所在的部分
要求:匹配上面的所有部分,但只返回2182所在的部分
解决方案 »
- 当MYSQL表类型为myisan时,如何保下数据的有效性?
- 急!!高分求教!!怎么可以通过遍历数据库实现一行多张图片列表而且实现分页功能
- php多行多列显示数据集怎么弄啊?
- 关于urlencode的一个小问题
- 遇到一个PHP连接MySQL问题,PHP支持MySQL,但是总是提示Access denied for user 'IUSR_TOMC-YKJ'@'localhost' (using password
- 用php怎样模拟aspx表单,才能让其分页,比如这个页面:http://book.taojin.com/result_book.aspx?rackcode=A01B01
- 请教一个模板问题
- 急:关于树的展开刷新问题!!
- 如何提交变量到另外一页?
- 请问apache 为什么不能正常运行?显示信息在正文中,在线等候!!!
- 这个搜索代码存在什么问题。。?在线等~。。
- php如何可以截取汉字字符串
preg_match_all('#href="http://www.sdfg.com/brands/(\d+)-(\d+).html"#', 'href="http://www.sdfg.com/brands/655-2182.html"', $m);
print_r($m[2]);//print_r($m[1]);
print_r($m[2]);//print_r($m[1]);
把前面的 href="http://www.sdfg.com/brands/ 和后面的 .html" 截去
剩下655-2182,- 字符分隔,第二部分就是你想要内容。
如655-2182长度固定就更好办。
<DIV class=hide id=o-mycart-list>
<DIV id=mycart-list></DIV></DIV></LI>
<LI class=fore2><A
href="http://jd2008.360buy.com/purchase/ShoppingCart.aspx">去结算</A>
</LI></UL><SPAN class=clr></SPAN></DIV></DIV>
<SCRIPT type=text/javascript>
(function(){var navigations=[{e:"computer",c:"电脑办公"},{e:"electronic",c:"家用电器"},{e:"digital",c:"手机数码"},{e:"home",c:"家居生活"},{e:"clothing",c:"服饰鞋帽"},{e:"beauty",c:"个护化妆"},{e:"watch",c:"钟表首饰"},{e:"book",c:"图书"},{e:"sports",c:"运动健康"},{e:"baby",c:"母婴玩具"},{e:"food",c:"食品饮料"}];$.each(navigations,function(i){if (navigations[i]["e"]==document.body.id){var nlink=(document.body.id=="book")?"<a href='http://book.360buy.com/'>图书</a>":"<a href='http://www.360buy.com/"+ navigations[i]["e"] +".html'>"+ navigations[i]["c"] +"</a>";$("#nav-extra").before("<div class='curr'>"+ nlink +"</div>");}});})();
$(".allsort").hoverForIE6({current:"allsorthover",delay:200});
$(".allsort .item").hoverForIE6({delay:150});
</SCRIPT><DIV class=w>
<DIV class=crumb><A href="http://www.360buy.com/">首页</A> > <A
href="http://www.sdfg.com/digital.html">手机数码</A> > <A
href="http://www.sdfg.com/products/652-653-000.html">手机通讯</A> > <A
href="http://www.sdfg.com/products/652-653-655.html">手机</A> > <A
href="http://www.sdfg.com/brands/655-2182.html">LG</A> > <A
href="http://www.sdfg.com/product/204811.html">LGGD580</A> </DIV></DIV><!--crumb end-->
<DIV class="w main">
<DIV class=right-extra>
<DIV id=name>
<H1>LG GD580 3G手机(波纹红)WCDMA/GSM<FONT id=advertiseWord
style="COLOR: #ff0000"></FONT></H1></DIV><!--pname end-->
<DIV id=preview>
<DIV class=jqzoom id=spec-n1
onclick="window.open('http://www.360buy.com/bigimage.aspx?id=204811')"><IMG
height=350 alt="LG GD580 3G手机(波纹红)WCDMA/GSM"