What\'s the best way to validate that an MAC address entered by the user?
The format is HH:HH:HH:HH:HH:HH, where each H is a hexadecimal ch
HH:HH:HH:HH:HH:HH
H
private static final String MAC_PATTERN = "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$"; private boolean validateMAC(final String mac){ Pattern pattern = Pattern.compile(MAC_PATTERN); Matcher matcher = pattern.matcher(mac); return matcher.matches(); }