ako mám spraviť podmienky na tie grupy?
s jednou grupou mi to ide, ale keď ich je tam viac tak to nejde
Kód:
private void processInput() {
final String regex = "([OM])([A-M])([1-8]) ";
// final String regex = "([OM])";
String s = readLine();
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(s);
if (matcher.matches()) {
if (matcher.group(1).equals("O"))
System.out.println("ano");
}else System.out.println("nie");
}