求一条正则表达式 在线等 实在是着急

时间:2022-04-22 21:55:15
分别需要
data-index=
href=
alt=
trace-price=
data-nick=

谢大神相助!!
自己写的
data-index="(?<id>\d*)"[\s\S]*href="(?<ItemURL>[\S]*)"[\s\S]*<img[\s\S]*alt="(?<biaoti>[\S]*)"[\s]*data-src[\s\S]*trace-price="(?<jiage>[.\d]*)"[\s\S]*data-nick="(?<wangwang>[\w]*)"

问题:只能匹配到页面里面的第一个开头和最后一个结尾


全部的html代码下不下了 太长了  这是一个宝贝的代码



<div class="item  " data-index="45【这里】">
  <div class="pic-box J_MouseEneterLeave J_PicBox">
    <div class="pic-box-inner">
      <div class="pic">
        <a class="pic-link J_U2IStat J_ItemPicA" id="J_Itemlist_PLink_45268934119" href="//item.taobao.com/item.htm?id=45268934119&amp;ns=1&amp;abbucket=10#detail【这里】" target="_blank" trace="auction" traceidx="45" trace-pid="-1977752113" trace-price="109.00" trace-num="48" trace-nid="45268934119" trace-index="45" data-href="//item.taobao.com/item.htm?id=45268934119&amp;ns=1&amp;abbucket=10#detail" data-nid="45268934119">
          
            <img class="J_ItemPic img" id="J_Itemlist_Pic_45268934119" alt="修身九分裤外贸女韩版直筒9分牛仔裤女夏薄款学生2015显瘦小脚潮【这里】" data-src="//g-search3.alicdn.com/img/bao/uploaded/i4/i3/TB13hOkHpXXXXaaXVXXXXXXXXXX_!!0-item_pic.jpg" data-ks-lazyload="//g-search3.alicdn.com/img/bao/uploaded/i4/i3/TB13hOkHpXXXXaaXVXXXXXXXXXX_!!0-item_pic.jpg_180x180.jpg">
          
        </a>
      </div>


      



      <div class="report">
        <a title="举报该宝贝" href="//archer.taobao.com/myservice/report/entry.htm?Query=修身九分裤外贸女&amp;auction_num_id=45268934119&amp;fromSource=search&amp;Category=0&amp;sort=all&amp;display_type=3" target="_blank">
          <span class="icon-btn-report"></span>
        </a>
      </div>

    </div>

    
  </div>
  

  <div class="ctx-box J_MouseEneterLeave J_IconMoreNew">

    <div class="row row-1 g-clearfix">
    
      
      <div class="price g_price g_price-highlight">
        <span>¥</span><strong>109.00</strong>
      </div>
      <div class="deal-cnt">21人付款</div>
      
        <div class="ship icon-service-free"></div>
      
    
    </div>

    <div class="row row-2 title">
      <a class="J_U2IStat" id="J_Itemlist_TLink_45268934119" href="//item.taobao.com/item.htm?id=45268934119&amp;ns=1&amp;abbucket=10#detail" target="_blank" trace="auction" traceidx="45" trace-pid="-1977752113" trace-price="109.00【这里】" trace-num="48" trace-nid="45268934119" trace-index="45" data-nid="45268934119">
        
        <span class="baoyou-intitle icon-service-free"></span>
        
        <span class="H">修身</span><span class="H">九分</span><span class="H">裤</span><span class="H">外贸</span><span class="H">女</span>韩版直筒9分牛仔<span class="H">裤</span><span class="H">女</span>夏薄款学生2015显瘦小脚潮
      </a>
    </div>

    
      <div class="row row-3 g-clearfix">
        <div class="shop">
          

  
    
      <a class="shopname J_MouseEneterLeave J_ShopInfo" href="//store.taobao.com/shop/view_shop.htm?user_number_id=2470705715" target="_blank" data-nid="45268934119" data-userid="2470705715">
        <span class="dsrs">
          
            <span class="dsr morethan"></span>
          
            <span class="dsr morethan"></span>
          
            <span class="dsr morethan"></span>
          
        </span>
        <span>玛莎精品服饰生活馆</span>
      </a>
    
  


        </div>

        <div class="location">广东 中山</div>
      </div>
    

    <div class="row row-4 g-clearfix">
      
      <div class="feature-icons icon-has-more" id="J_Itemlist_Icons_45268934119">
        <ul class="icons">
          
          

          
            <li class="icon J_IconPopup J_MouseEneterLeave" data-index="0">
              
              
                
                  <span class="icon-service-baoxian"></span>
                
              
            </li>
          
        </ul>
      </div>

      
        
          <div class="wangwang">
            <span class="J_WangWang" data-encode="true" data-icon="small" data-item="45268934119" data-display="inline" data-nick="玛莎精品服饰生活馆【这里】"></span>
          </div>
        
      
    </div>

  </div>

  
</div>

2 个解决方案

#1


data-index="(?<id>\d*)"[\s\S]*?href="(?<ItemURL>[\S]*?)"[\s\S]*?<img[\s\S]*?alt="(?<biaoti>[\S]*?)"[\s]*data-src[\s\S]*?trace-price="(?<jiage>[.\d]*)"[\s\S]*?data-nick="(?<wangwang>[\w]*)"

给所有的地方加了非贪婪试试

#2


http://blog.csdn.net/zm2714/article/details/7946437

#1


data-index="(?<id>\d*)"[\s\S]*?href="(?<ItemURL>[\S]*?)"[\s\S]*?<img[\s\S]*?alt="(?<biaoti>[\S]*?)"[\s]*data-src[\s\S]*?trace-price="(?<jiage>[.\d]*)"[\s\S]*?data-nick="(?<wangwang>[\w]*)"

给所有的地方加了非贪婪试试

#2


http://blog.csdn.net/zm2714/article/details/7946437