$re = '/^((?!\sid: \'(.*?)\',).)+$/m';
$str = 'result get: [ { __tenant: \'dev_gaus\',
partitionKey: \'customization_custContextsByStudent0\',
ref: \'CustContext-6faccf25-7cff-4d28-aa01-ef242d43f9eb\',
id: \'6950d15e-332d-4dcf-8f60-c887b52b7c74\',
timestampOfLastReducedEvent: \'2016-10-17T10:43:22.562Z\',
payload:
{ custContextId: \'6faccf25-7cff-4d28-aa01-ef242d43f9eb\',
students: [Object] },
_rid: \'0jBGAOGkewADAAAAAACABA==\',
_self: \'dbs/0jBGAA==/colls/0jBGAOGkewA=/docs/0jBGAOGkewADAAAAAACABA==/\',
_etag: \'"2900f221-0000-0000-0000-5804ab5d0000"\',
_attachments: \'attachments/\',
_ts: 1476701006 },
{ __tenant: \'dev_gaus\',
partitionKey: \'customization_custContextsByStudent0\',
ref: \'CustContext-c19a7792-2521-4491-833a-6462cf5fea84\',
id: \'f37f54bf-ab58-4e4a-b5d3-5aeff0abdd65\',
timestampOfLastReducedEvent: \'2016-10-17T10:46:16.289Z\',
payload: { \'55\': [Object] },
_rid: \'0jBGAOGkewAEAAAAAACABA==\',
_self: \'dbs/0jBGAA==/colls/0jBGAOGkewA=/docs/0jBGAOGkewAEAAAAAACABA==/\',
_etag: \'"2900f321-0000-0000-0000-5804abfa0000"\',
_attachments: \'attachments/\',
_ts: 1476701163 },
{ __tenant: \'dev_gaus\',
partitionKey: \'customization_custContextsByStudent0\',
ref: \'CustContext-d528c0aa-71c6-4b20-b828-6e8068d77900\',
id: \'4358d14c-c001-4d46-bc8b-9d29a6a426b7\',
timestampOfLastReducedEvent: \'2016-10-17T10:49:48.122Z\',
payload: { \'52\': [Object], \'55\': [Object] },
_rid: \'0jBGAOGkewAIAAAAAACABA==\',
_self: \'dbs/0jBGAA==/colls/0jBGAOGkewA=/docs/0jBGAOGkewAIAAAAAACABA==/\',
_etag: \'"2900f721-0000-0000-0000-5804acce0000"\',
_attachments: \'attachments/\',
_ts: 1476701375 } ]
';
$subst = "";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
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