I am trying to extract a string from a json object using regexs in java.
The string looks like this:
{"key":"value"}
The regex method code looks like this:
public String extractVal(String dataRaw) {
Pattern p = Pattern.compile(":\"(.+\b)");
Matcher m = p.matcher(dataRaw); //dataRaw is string from above^
if (m.matches()) {
return m.group(1);
}
return null;
}
It always just returns null. What did I do wrong?
Thanks in advance