I am using ipconfig/all command and regular expression in java to find out the MAC address.
I am searching Physical Address in the output of ipconfig/all command.
But problem is I want regular expression to work on different locale i.e. it can find the Physical Address for any locale.
Thanks in advance.
Rather than searching for “Physical Address,” or any other localized version of that (which will require you to add a localized version each time you need to support a new language), you could write just one regex to find the MAC address itself.
Since we know that a typical MAC addresses is comprised of six groupings of two hex digits each, separated by colons, periods, or dashes, the following regex will do it:
Explanation:
(two hex digits followed by a colon :, repeated 5 times) (the final two hex digits)