Looks simple enough, you need to escape your double quotes.
String input = "Key: \"employeeNo\" with value \"ABC12345\" is already used.";
Pattern p = Pattern.compile("Key: \"employeeNo\" with value \"(ABC\\d+)\" is already used.");
Matcher m = p.matcher(input);
if (m.find()) {
System.out.println(m.group());
System.out.println(m.group(1));
}
Output
Key: "employeeNo" with value "ABC12345" is already used.
ABC12345
If you need the double quotes inside the back-referenced group (group 1), just enclose the escaped double-quotes in the group parenthesis: (\"ABC\\d+\")
.