$re = '/(view_manage_opportunities),(view_page[^,]*)/m';
$str = 'DCA,customer1,company1,SID1,cherie,cherie,"view_page_modulepicker,explore_more_connect with people" DCA,customer2,company2,SID2,cherie,cherie,"view_manage_opportunities,view_page_modulepicker,back_to_opp,view_page_modulepicker" DCA,customer1,company1,SID1,cherie,cherie,"view_manage_opportunities,view_page_modulepicker,explore_more_connect with people" DCA,customer1,company1,SID1,cherie,cherie,"view_page_modulepicker" DCA,customer1,company1,SID1,cherie,cherie,"view_manage_opportunities" DCA,customer4,company1,SID4,cherie,cherie,"view_manage_opportunities,view_page_actionSource" DCA,customer4,company1,SID4,cherie,cherie,"view_manage_opportunities,view_page_homePage" DCA,customer4,company1,SID4,cherie,cherie,"view_manage_opportunities,view_page_capabilities"';
$subst = "$2,$1";
$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