<?php
preg_match_all('/[dog]+((?![\w,]))/', 'dog god ogd, dogs o', $arr, PREG_PATTERN_ORDER);
 
print_r($arr);
?>