$re = '~APIDETAILS=(.*?)(?=}|,\s*\S+=|$)~';
$str = '{APIDETAILS=FOO, BAR, SING, RUN, OP1/OPSUB1/RESULT=SOMETHING, OP1/OPSUB2/RESULT=SOMETHING, OP2/OPSUB1/RESULT=SOMETHING}
{APIDETAILS=FOO, OP1/OPSUB1/RESULT=SOMETHING, OP1/OPSUB2/RESULT=SOMETHING, OP2/OPSUB1/RESULT=SOMETHING}
{APIDETAILS=FOO, O.P.OP3/OPSUB1/RESULT=SOMETHING, OP1/OPSUB2/RESULT=SOMETHING, OP2/OPSUB1/RESULT=SOMETHING}
{APIDETAILS=FOO, OP.PO.OP4/OPSUB1/RESULT=SOMETHING, OP1/OPSUB2/RESULT=SOMETHING, OP2/OPSUB1/RESULT=SOMETHING}
{OP1/OPSUB1/RESULT=SOMETHING, OP1/OPSUB2/RESULT=SOMETHING, OP2/OPSUB1/RESULT=SOMETHING, APIDETAILS=FOO}
{OP1/OPSUB1/RESULT=SOMETHING, OP1/OPSUB2/RESULT=SOMETHING, OP2/OPSUB1/RESULT=SOMETHING, APIDETAILS=FOO, SING, BAR}
{OP1/OPSUB1/RESULT=SOMETHING, OP1/OPSUB2/RESULT=SOMETHING, OP2/OPSUB1/RESULT=SOMETHING, APIDETAILS=FOO, BAR, SING';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php