Regex for the MAC ID pattern to restrict FF:FF:FF:FF:FF:FF and leading 01-xx-xx-xx-xx-xx,

I tried to construct a working regex for the mentioned scenario but it’s not working.

  1. It should restrict the MAC IDs with leading "01" (01-xx-xx-xx-xx-xx). eg

01:AA:BB:05:31:01 <- Not valid.

21:51:51:31:01:AA <- Valid.

  1. It should restrict FF:FF:FF:FF:FF:FF full match.

What I have done so far is here.

^((?!01|FF|88|87|ff|00)[0-9a-fA-F]{2}([:-]|$)){6}$

14 thoughts on “Regex for the MAC ID pattern to restrict FF:FF:FF:FF:FF:FF and leading 01-xx-xx-xx-xx-xx,”

Leave a Comment