1

Couldn't seem to find anything Java-specific here in SO.

I'm trying to get at a MAC address.

For example:

String input = "9hin00:1b:63:84:45:e6n0hu";

I need to get "00:1b:63:84:45:e6"

where MAC address could be any set of characters, but always with the "..:..:..:..:..:.." pattern

user589879
  • 51
  • 7

1 Answers1

1

You can use this regex for matching MAC address:

(?:[a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}

RegEx Dmo

anubhava
  • 761,203
  • 64
  • 569
  • 643