$t = "javascript:textoFunction();"; // aveces no tiene el : ni ; $t = preg_replace('/javascript(.:?)(.+)[\)]/i', '\2', $t);