I have a configuration file in which I am replacing some placeholder(variables) with their actual value after parsing an excel file. I am using the below pattern:
word = word.startsWith("$") ? word.substring(1) : word;
return input.replaceAll(Pattern.quote("$"+word),
Matcher.quoteReplacement(prefix));
The above is replacing all the sub-strings as well as is case sensitive. For example if I have the below 2 variables: $Building $Building1 , both are different variables. But the above replaces the value of Building in both cases and appends it with "1" in the second case. Could you guys please help me change the pattern. I have tried case_insensitive option but that did not work fine.