I have an input string -
f.dollar_sales,f.unit_sales
I want to use String.replaceAll(regex,regex) method to get an output string as follows:
dollar_sales,unit_sales
I used the following:
fieldList.replaceAll("[a-zA-Z]\\Q.\\E"," ");
where fieldList is String variable where I've stored input String.
Can someone point out where I've made a mistake?
f.before the values you want, or will it always be a[a-z].? Do you need regular expression for this or would a simplesubstringsuffice?System.out.println(string.replaceAll("[a-zA-Z]\\Q.\\E", ""));replace the match with an empty string not with a space.