Java replaceAll not working with dollar sign in source string
2 answers
Your list of stored characters includes #-', which is a range from Unicode U + 0023 (character #) to U + 0027 (character '), including $(U + 0024).
If you meant #-'to interpret it as a three-character list, just avoid it:
test = test.replaceAll("[^A-Za-z0-9./,#\\-' ]", "");
or put it at the end of the list:
test = test.replaceAll("[^A-Za-z0-9./,#' -]", "");
+11