I have a String with a content and I need to do a replaceAll, however the text to be replaced contains a dollar sign "$" and this causes the error Illegal group reference
.
Example:
String texto="teste {{texto}} teste";
String trocar="_$_";
texto=texto.replaceAll("\{\{texto\}\}", trocar);
Note: This "swap" String comes from a database, so I can not add the \. The example is illustrative only.