This is my original String:
String response = "attributes[{"id":50,"name":super},{"id":55,"name":hello}]";
I'm trying to parse the String and extract all the id
values e.g
50
55
Pattern idPattern = Pattern.compile("{\"id\":(.*),");
Matcher matcher = idPattern.matcher(response);
while(matcher.find()){
System.out.println(matcher.group(1));
}
When i try to print the value i get an exception:
java.util.regex.PatternSyntaxException: Illegal repetition
Not had much experience with regular expressions in the past but cannot find a simple solution to this online.
Appreciate any help!