I'm trying to extract a value from some text (scraped from a web site) using a regular expression and It's not playing ball. Here's the text (with the value I want in bold) <span id="DetailsCurrentBidValue" class="sectiontitle"><b>GBP 49.99 </b></span> Here is my regular expression: '#id="DetailsCurrentBidValue".+\s([\d]+\.[\d]+)#i' However, when I change my regular expression to this (remove the '\s'): '#id="DetailsCurrentBidValue".+([\d]+\.[\d]+)#i' It returns '9.99. It should return 49.99 Any ideas? could this be an encoding issue? Thanks!
This sucking of others sites might be wrong, neither preg_match, nor you... You can try something like this : #id="DetailsCurrentBidValue"[^\d]+([\d]+\.[\d]+)# BUT!!! Be careful. As soon as there'll be some number in 'class' attribute, it'll fail.
Thanks very much. For the record, I'm not leeching content. I'm building an eBay sniper. I really appreciate your help. Page code: <span id="DetailsCurrentBidValue" class="sectiontitle"><b>US $44.00 </b></span> Tried Regex: '#id="DetailsCurrentBidValue".+[^\d]([\d]+\.[\d]+)#i' Also Tried: '#id="DetailsCurrentBidValue".+\$([\d]+\.[\d]+)#i' Thanks