//... $shows=preg_replace("@(.*?)@si","$2",$rock); $s=array( "@@si", //... } $r=array( "@".$shows, //... } $rocks=preg_replace($s,$r,$rocks); //...