how to replace $ character?

recently I use the java.util.regex to replace a piece of string in one text? but the string contains the character of $, whatever i do,it is wrong! can you help me?

the code:

Pattern p = Pattern.compile("a\$b");

Matcher m = p.matcher(aaa$b );

bufferstring = m.replaceAll("ok");

I want to replace the "a$b" of "ok" in the String "aaa$b". how to do it ?

thanks

[423 byte] By [linugb118] at [2007-9-30 13:47:43]
# 1
% print("aaa$b".replaceAll("a\\$b", "ok"));aaok
jsalonen at 2007-7-4 23:20:59 > top of Java-index,Administration Tools,Sun Connection...