2013-02-19 131 views
-1

我如何可以提取該HTML片段的文字...結合兩個正則表達式

<span id='amount'>&pound;86,950</span></div> 
        <p class="bedrooms">2 bed mews house for sale</p> 
        <h2 class="address"> 
         <a href="...31073581.html?showcase=true&premiumA=true">Wilson Street,city 123 
</a></h2> 

我想提取

2牀的馬廄出售房子
威爾遜街道,城市123

即時通訊使用regexbuddy和我可以前道值$pound567849(通過&pound.*\d

我可以通過<p calss.*>.*</p>提取一個標籤的值(不能使用這兩個together..dont知道如何)我

,但不知道如何將兩個表達式組合到那裏值集體......有誰能夠幫助PLZ(可悲的是新的正則表達式,提取事物)

+0

你在用什麼語言? – 2013-02-19 10:05:06

回答

0

,你可以用這個(?<=(amount|bedrooms)["']>)(.+?)(?=<)獲得價值

或這一個amount'>(.+?)<.*?bedrooms">(.+?)<你的價值的陣列將在第1組和2