According to JavaDoc, the .replaceAll(String regex, String replacement) method accepts a regular expression as the first parameter.
It so happened that { and } have special meaning in the syntax of regular expressions and, therefore, must be escaped. Try using str.replaceAll("\\{Name\\}","A"); .
An optional \ in front instructs the regex engine to threaten { and } as valid characters (without their special meaning). Since this is Java, you also need to escape the \ character, so you need two of them.
source share