public function ReplaceBadURLs($Matches) { $MatchedURL = $Matches[0]; $FixedURL = array_pop($Trash = explode("/*", $MatchedURL)); return 'href="' . $FixedURL . '"'; }