String input = " Fa0/1 --- Cisco IP phone notconnected 20 a-full auto 10/100BaseTX"
String DISABLED = "disabled";
String CONNECTED = "connected";
String NOTCONNECTED = "notconnected";
String REGEXP_STATUS = "^(\\s*)(\\w+/\\d+|\\w+/\\d+/\\d+)(\\s+)(.*|\\*|-)(" + NOTCONNECTED + "|" + DISABLED + "|" + CONNECTED + ")(\\s+)(\\d+|trunk)(\\s+)(\\w+|a-\\w+)(\\s+)(\\w+|a-\\d+)(\\s+)(\\w+|/+).*";
Моя проблема в matcher.group(5)
return CONNECTED
, если ввод NOTCONNECTED
, потому что СОЕДИНЕНО слово в НЕ СОЕДИНЕНО
РЕДАКТИРОВАТЬ:
Я пытаюсь:
String REGEXP_STATUS = "^(\\s*)(\\w+/\\d+|\\w+/\\d+/\\d+)(\\s+)(.*|\\*|-)(" + DISABLED + "|.*" + CONNECTED + ")(\\s+)(\\d+|trunk)(\\s+)(\\w+|a-\\w+)(\\s+)(\\w+|a-\\d+)(\\s+)(\\w+|/+).*";
но matcher.group(5)
возврат CONNECTED
и matcher.group(4)
возврат --- Cisco IP phone not