I have to extract the value of an environment variable using a java method.
My path is ${rootPath}/user/settings and the value I want to get is rootPath.
I tried the following but it says "not match found":
Pattern.compile("\\$\\{(\\w+)\\}").matcher("${rootPath}/user/settings").group(1);
If I use the replace method it replaces the ${rootPath} value. What am I doing wrong?