$re = '/(-x ("|\'))(\w+)\2(?!.*(?1)\3["|\'])/ms';
$str = 'testuser /get_results.sh -q -x \'igp_srm_m\' -s \'yesterday\' -e \'yesterday\' -m \'2048\' -b >>\'/var/log/process/srm-console.log\' 2>&1
00 10 * * 2-6 testuser /get_results.sh -q -x \'igp_srm_m\' -s \'yesterday\' -e \'yesterday\' -m \'2048\' -w \'720\' >>\'/var/log/process/srm-console.log\' 2>&1
00 08 * * 1-5 testuser /get_results.sh -q -x "igp_srm_m" -s "today" -e "today" -m "90000" -b -z partA >>"/var/log/process/france-partA-console.log" 2>&1
00 12 * * 2-6 testuser /get_results.sh -q -x "igp_france" -s "yesterday" -e "yesterday" -m "90000" -w "900" -z partA >>"/var/log/process/france-partA-console.log" 2>&1
00 08 * * 1-5 testuser /get_results.sh -q -x "igp_france" -s "today" -e "today" -m "90000" -b -z partB >>"/var/log/process/france-partB-console.log" 2>&1
00 12 * * 2-6 testuser /get_results.sh -q -x "igp_france" -s "yesterday" -e "yesterday" -m "90000" -w "900" -z partB >>"/var/log/process/france-partB-console.log" 2>&1
00 12 * * 2-6 testuser JAVA_OPTS=\'-server -Xmx512m\' /merge.sh "yesterday" "igp_france" "partA,partB" >>"/var/log/process/france-console.log" 2>&1
00 08 * * 1-5 testuser /get_results.sh -q -x "igpswitz_france" -s "today" -e "today" -m "15000" -b >>\'/var/log/process/igpswitz_france-console.log\' 2>&1
00 12 * * 2-6 testuser /get_results.sh -q -x "igpswitz_france" -s "yesterday" -e "yesterday" -m "15000" -Dapc.maxalerts=8000 -w "900" >>\'/var/log/process/igpswitz_france-console.log\' 2>&1
30 07 * * 2-6 testuser /get_results.sh -q -x "igp_franced" -s \'yesterday\' -e \'yesterday\' -m "105000" -b >>"/var/log/process/franced-console.log" 2>&1
15 12 * * 2-6 testuser /get_results.sh -q -x "igp_franced" -s \'yesterday\' -e \'yesterday\' -m "105000" -w "960" >>"/var/log/process/franced-console.log" 2>&1
';
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