As the saying goes
The first pattern that comes to mind is
CMD([0-9]{3})|LED|FOO|BAR
but the Arduino-listed Regexp library does not support | for alternates (nor {} for repetitions, although that is easily worked-around in this case).
It's simpler to just startsWith instead of equals and some logic
if (command.startsWith("CMD")) {
command = command.substring(3);
if (command.length()) {
int num = command.toInt();
if (num > 360) {
Serial.println("max is 360");
} else if (num < 0) {
Serial.println("not negative");
} else if (num > 0 || command.startsWith("0")) {
Serial.println("do CMD: " + command);
} else {
Serial.println("invalid CMD: " + command);
}
} else { // "".toInt() returns 0 as well
Serial.println("missing CMD number");
}
} else if (command.equals("LED")) {
Serial.println("OK, turn on LED");
} else {
Serial.println("no match");
}
BTW, startsWith() is equivalent to indexOf() == 0. You don't want to match XCMD for example, where the index is 1.