python - Regex matching MAC address -


i'm trying valid mac addresses string:

00:1e:68:51:4f:a9    <-> 00:1a:8c:10:ad:30          9       540       8       336      17       876    90.457130000       198.0143 

i've tried , few other regexes:

^([0-9a-f]{2}[:]){5}([0-9a-f]{2})$ 

regex 101 here:

https://regex101.com/r/ki5ni6/1

i can't figure out why i'm not getting matches.

  • you have remove anchors ^ , $

  • you have add a-z in character set.. or make searches case insensitive (?i) (i modifier)

following work:

([0-9a-fa-f]{2}[:]){5}([0-9a-fa-f]{2}) 

see demo


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -