I need to use the method replaceAll of the String class to extract a configuration path from a large String.
I managed to exclude the left side of the String with a regular expression, however I'm facing problems with the right side. Here is it:
/home/user/qa/jboss-eap-7.2/standalone/configuration", "jboss.server.data.dir" : "/home/user/qa/jboss-eap-7.2/standalone/data", "jboss.server.deploy.dir" : "/home/user/qa/jboss-eap-7.2/standalone/data/content", "jboss.server.log.dir" : "/home/user/qa/jboss-eap-7.2/standalone/log", "jboss.server.name" : "fedora", "jboss.server.persist.config" : "true", "jboss.server.temp.dir" : "/home/user/qa/jboss-eap-7.2/standalone/tmp", "line.separator" : "\n", "logging.configuration" : "file:/home/user/qa/jboss-eap-7.2/standalone/configuration/logging.properties", "module.path" : "/home/user/qa/jboss-eap-7.2/modules", "org.apache.xml.security.ignoreLineBreaks" : "true", "org.jboss.boot.log.file" : "/home/user/qa/jboss-eap-7.2/standalone/log/server.log", "org.jboss.resolver.warning" : "true",
So I just want to capture the String /home/user/qa/jboss-eap-7.2/standalone/configuration and I have come up with this:
// String a contains the above text
String b = a.replaceAll("^\".*","");
System.out.println(b);
This is supposed to remove everything, beginning from the first occurrence of the quotes("). However it does not work as expected as the full String is returned. Anyone can help me to find out why? Thanks