If body is the string "{oli22} potatoes are cool" anyone know why when this code returns an illegal state exception: no match found when either of the group(1) begin to look for their patterns. Thanks for you help.
private static final Pattern BRACE_END = Pattern.compile(".*\\}");
private static final Pattern EGGS = Pattern.compile("\\{(.*)\\}");
private static final Pattern BACON = Pattern.compile("\\}(.*)");
public class jibbles {
public boolean workdamnyou(String body, Data data){
if (body.startsWith("{")){
if (BRACE_END.matcher(body).lookingAt()){
if (EGGS.matcher(body).find()){
eggs = EGGS.matcher(body).group(1);
}
if (BACON.matcher(body).find()){
bacon = BACON.matcher(body).group(1);
}
}
}
}