parse string with regular exression
- by llamerr
I trying to parse this string:
$right = '34601)S(1,6)[2] - 34601)(11)[2] + 34601)(3)[2,4]';
with following regexp:
const word = '(\d{3}\d{2}\)S{0,1}\([^\)]*\)S{0,1}\[[^\]]*\])';
preg_match('/'.word.'{1}(?:\s{1}([+-]{1})\s{1}'.word.'){0,}/', $right, $matches);
print_r($matches);
i want to return array like this:
Array
(
[0] =>…