您只需要将否定符号添加到否定的字符类中。我可能还会做一些其他的调整。
片段:(
Full Demo
$cleanString = preg_replace('/[^\d.,-]/', '', $money);
$onlyNumbersString = preg_replace('/[^\d-]/', '', $money);
$separatorsCountToBeErased = strlen($cleanString) - strlen($onlyNumbersString) - 1;
$stringWithCommaOrDot = preg_replace('/[,.]/', '', $cleanString, $separatorsCountToBeErased);
$removedThousandSeparator = preg_replace('/[.,](?=\d{3,}$)/', '', $stringWithCommaOrDot);
array(6) {
["cleanString"]=>
string(11) "-200.000,54"
["onlyNumbersString"]=>
string(9) "-20000054"
["separatorsCountToBeErased"]=>
int(1)
["stringWithCommaOrDot"]=>
string(10) "-200000,54"
["removedThousandSeparator"]=>
string(10) "-200000,54"
["result"]=>
float(-200000.54)
}