What is the correct regular expression for matching MAC addresses ? I googled about that but, most of questions and answers are incomplete. They only provide a regular expre
MAC Address can be validated with the below code:
private static final String PATTERN = "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$"; private static boolean validateMAC(String mac) { Pattern pattern = Pattern.compile(PATTERN); Matcher matcher = pattern.matcher(mac); return matcher.matches(); }