<?php $re = '`\b(?:Sunscreen|Lubricant)\h+[^()]*\((\d+)\h+Quantity\)`'; $str = 'Sunscreen 25g (200 Quantity) Lubricant 100ml (50 Quantity)'; preg_match_all($re, $str, $matches); $result = array_map("intval", $matches[1]); var_dump($result);
You have javascript disabled. You will not be able to edit any code.