$re = '/(?P<oxford_comma>,)(?=\s+(and|or))/';
$str = 'The canning, processing, preserving, freezing, drying, marketing, storing, packing for shipment or distribution of:
Agricultural produce;
Meat and fish product; and
Perishable foods
The canning, processing, preserving, freezing, drying, marketing, storing, packing for shipment, or distribution of:
While Sean was waiting for Kyle to pick up Chinese for dinner, he scraped the paint off the bathroom door frame, alphabetized his books by main character’s first name, and successfully startled the neighbor’s boxer twice.
The Oxford comma makes these sentences carry entirely different meanings:
Amanda found herself in the Winnebago with her ex-boyfriend, an herbalist and a pet detective.
Amanda found herself in the Winnebago with her ex-boyfriend, an herbalist, and a pet detective.
';
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