I am trying to extract prices for a product from a webpage using a php script. The string in question consists of the following html:
<div class="pd_warranty col-xs-12 no-padding">
<p class="selectWty txtLeft">Available Options</p>
<div class="vspace clear"></div>
<div class="subProd col-xs-4 noPadLR">
<a href="https://www.example.com/single” class="selected">
<div class="col-xs-12 cellTable pad5All">
<div class="col-xs-8 noPadLR cellTableCell">
<p class="noMar txtLeft">Single</p>
<p class="noMar txtLeft sml">$99.99</p>
</div>
</div>
</a>
</div>
<div class="subProd col-xs-4 noPadLR">
<a href="https://www.example.com/2pack” class="">
<div class="col-xs-12 cellTable pad5All">
<div class="col-xs-8 noPadLR cellTableCell">
<p class="noMar txtLeft">2-PACK</p>
<p class="noMar txtLeft sml">$159.99</p>
</div>
</div>
</a>
</div>
<div class="subProd col-xs-4 noPadLR">
<a href="https://www.example.com/4pack” class="">
<div class="col-xs-12 cellTable pad5All">
<div class="col-xs-8 noPadLR cellTableCell">
<p class="noMar txtLeft">4-PACK</p>
<p class="noMar txtLeft sml">$249.99</p>
</div>
</div>
</a>
</div>
</div>
There are three groups of prices on most products: Single 2-PACK 4-PACK
Some pages may not have one or both 2-PACK or 4-PACK.
I failed attempting to write a regex expression to extract the info I need from a variable with the above string. I am trying to make a php regex expression to extract the words single/2-pack/4-pack and price in an array[type][price] to represent if each type is present in the html with price.
Any help with the regex expression would be greatly appreciated.