Java replace all square brackets in a string
The replaceAll method is attempting to match the String literal [] which does not exist within the String try replacing these items separately. String str = “[Chrissman-@1]”; str = str.replaceAll(“\\[“, “”).replaceAll(“\\]”,””);