Can anyone send javascript code to validate the network mac address (eg. 02:41:6d:22:12:f1
) It accepts value from 00:00:00:00:00:00
to ff:ff:ff:ff:ff:ff
. On keypress event of textbox, I need to allow characters 0-9
, a-f
and :
(colon). What I have so far is
macPattern = /^([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}$/i;
With this I am able throw exception for ff:ff:ff:ff:ff:ff
but I also need to throw an exception for 00:00:00:00:00:00
. My pattern is not throwing an exception.
Could you please give me a pattern through which I should able to throw an exception for both ff:ff:ff:ff:ff:ff
and 00:00:00:00:00:00
.