[eluser]uptime[/eluser]
First of all, you may have forgotten the last "}". (the one that ends the function block.)
Second, the code looks OK besides this (it's in the second $trans array):
Code:
"[^a-z0-9".$replace."]" => '',
$replace equals a dash '-' and should be escaped (here's what it looks at that point "[^a-z0-9-]").
You should probably escape it:
Code:
"[^a-z0-9\\" . $replace . "]" => '',
Not sure that's your problem, I got what you're getting locally (a dash) using PHP 5.3.0 and PCRE 7.9.
If you're still getting different results, I'd suggest you start comparing PHP and PCRE lib versions, it's very important to have the same environment as the server (or at least, as close as you can) to avoid such problems.