I really suck with regex, and as luck would have it I need to use it today to solve a problem. I have to scrape a HTML page, and extract some specific information.
I am looking for this line in the HTML.
The span will remain static as will the class names.<span id="pricePlusShippingQty"><b class="price">£29.99</b><span class="plusShippingText"> + £5.40 shipping</span>
I need to extract "5.40".
However, as this value will change from page to page it needs to be able to cope with the following scenarios.
Unsure of how many numbers will be in the price, Example:
£1.99
£11.99
£111.99
when the price is over £1000 the formatting changes as follows,
1,297.95
Also, a price in thousands could be as the earlier example.
1,297.95
11,297.95
111,297.95
Another possible value instead of a numeric value is the wording "FREE SHIPPING". I will need to change a returned value of "FREE SHIPPING" to be 0.00 later in the script.
I am not sure how to go about extracting the data per my examples/specification above. If anybody would be kind enough to help me out it will be greatly appreciated
Thanks in advance,
Noodle