Saturday, March 8, 2008, 11:58:35 PM, Hans wrote: > A less aggressive and more precise replacement can be done instead > with: > foreach($g as $k=>$v) > $fmt = preg_replace("/$k/",$v $fmt); that does not do it. Perhaps this, which asks for a word boundary: foreach($g as $k => $v) $fmt = preg_replace( "/\\$k\\b/", $v, $fmt); Hans