\w*)/(?\d*)#i','anyEmbedGIST'); function anyEmbedGIST($matches, $attr, $url, $rawattr){ //$embed = sprintf('', $matches['USER'], $matches['GUID']); $embed = sprintf('', $matches[0]); return apply_filters('GIST', $embed, $matches, $attr, $url, $rawattr); } // embed ed2k link add_filter('the_content', 'anyEmbedHTML'); function anyEmbedHTML($html){ $pattern = array( '#ed2k://\|file\|([^|]+)\|(\d+)\|[0-9A-Z]{32}\|(h=[0-9A-Z]{32}\|)?/#i', ); $replacement = array( 'ed2k://$1', ); return preg_replace($pattern, $replacement, $html); }