I am using regex to parse the currency in this format. I extract the price by scraping amazon.com
$current_price=$doc['#current-price']->text();
$this->rawPrice=$current_price;//Value =$9.65
$price_elements=array();
preg_match("/(\$|£)([0-9,\.]+)/", $current_price,$price_elements);
$this->price_elements=$price_elements;//Array is empty
$this->price=$price_elements[2];//NO index found warning
I can't understand why the regex is not parsing the value $9.65 . I have tried it on regexr as well and it works fine. Its output as json, so I know the price is retrieved correctly. Just don't know why it doesnt parse.