日期:2014-05-18  浏览次数:20496 次

哪位兄弟给个验证MAC地址的正则表达式
要验证MAC地址
比如:
00-0B-2F-02-37-C8
00-E0-4C-77-B1-B6

从网上找到一个
^(?:(?'1'[0-9a-fA-F]{2})(?:\:)(?'2'[0-9a-fA-F]{2})(?:\:)(?'3'[0-9a-fA-F]{2})(?:\:)(?'4'[0-9a-fA-F]{2})(?:\:)(?'5'[0-9a-fA-F]{2})(?:\:)(?'6'[0-9a-fA-F]{2}))$|^(?:(?'1'[0-9a-fA-F]{2})(?:\-)(?'2'[0-9a-fA-F]{2})(?:\-)(?'3'[0-9a-fA-F]{2})(?:\-)(?'4'[0-9a-fA-F]{2})(?:\-)(?'5'[0-9a-fA-F]{2})(?:\-)(?'6'[0-9a-fA-F]{2}))$
发现不起作用

先谢谢了

------解决方案--------------------
Mac地址以空格,"-",":"分开

^([0-9a-fA-F]{2})(([0-9a-fA-F]{2}){5})$
------解决方案--------------------
探讨
MAC地址 正则表达式
^([0-9a-fA-F]{2})(([/\s:-][0-9a-fA-F]{2}){5})$
Mac地址以空格,"-",":"分开

^([0-9a-fA-F]{2})(([0-9a-fA-F]{2}){5})$

中间没有任何符号