$re = '/(?s)json:(?!.*json:.*totalCount.*).*?totalCount.*?(?=\[2)/m';
$str = '[2018-12-10 06:30:44]JSON回调处理--->>> 同步运动数据 [2018-12-10 06:30:44]同步运动健康数据json:{ "day" : 10, "items" : [ { "activeTime" : 5, "calory" : 0, "distance" : 0, "stepCount" : 0 },
{ "activeTime" : 0, "calory" : 0, "distance" : 0, "stepCount" : 0 }, { "activeTime" : 0, "calory" : 0, "distance" : 0, "stepCount" : 0 } ], "month" : 12, "startTime" : 0, "timeSpace" : 15, "totalActiveTime" : 81, "totalCalory" : 0, "totalDistance" : 0, "totalCount" : 0, "year" : 2018 }
[2018-12-10 06:30:44]同步运动健康数据items.sise()=96
[2018-12-10 06:30:38]..再同步健康数据...
[2018-12-10 06:30:44]JSON回调处理--->>> 同步运动数据 [2018-12-10 06:30:44]同步运动健康数据json:{ "day" : 10, "items" : [ { "activeTime" : 5, "calory" : 0, "distance" : 0, "stepCount" : 0 },
{ "activeTime" : 0, "calory" : 0, "distance" : 0, "stepCount" : 0 }, { "activeTime" : 0, "calory" : 0, "distance" : 0, "stepCount" : 0 } ], "month" : 12, "startTime" : 0,
"timeSpace" : 15, "totalActiveTime" : 81, "totalCalory" : 0, "totalDistance" : 0, "StepCount" : 0, "year" : 2018 }
[2018-12-10 06:30:44]同步运动健康数据items.sise()=96
[2018-12-10 06:30:38]..再同步健康数据... ';
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