You need to escape the dollar sign with a backslash, \$
, otherwise it is interpreted as end of line/string.
Also, the second parentheses set are entirely unnecessary - you are not using the group you capture.
Oh, and to avoid replacing something like $100 you will need to add 0-9 to your negative lookbehind... since you're doing that, you can simply place the dollar inside the character class and escaping is not required.
So at this point we have:
$comments = preg_replace("/(?<![$0-9])[0-9]+/", "x", $comments);
But apparently "preg_replace does not support repition in a look-behind" - which I'm taking to mean you can't put 0-9 in the lookbehind, so instead placing a word boundary before it.
Also something to avoid is replacing $9.99, so hopefully we can specify \d. in the lookbehind to disallow that.
So your code eventually becomes:
$comments = preg_replace("/(?<!\$|\d\.)\b[0-9]+\b/", "x", $comments);
With all this added complexity, you'll want to create some test cases to make sure that works as intended.