I supose that you don't need the regexp for this.
try something like the next pice of code.
<?php
$stringNames = "____ #NAME#.....#NAME#......#NAME#";
$names =array('name1','name_2','name_3') ;
$tag_len = strlen("#NAME#");
for($i=0;$pos=strpos($stringNames,"#NAME#",$pos),is_int($pos);$i++)
{
$stringNames = substr_replace($stringNames,$names[$i],$pos,$tag_len);
}
print($stringNames);
?>