/^[\da-f][\da-f]: [\da-f][\da-f]: [\da-f][\da-f]: [\da-f][\da-f]: [\da-f][\da-f]: [\da-f][\da-f]$/ix
Or with less typing:
/^ (?: [\da-f]{2}: ){5} [\da-f]{2} $/ix;
I used the /x modifier to allow for freeform whitespace within the RE. I used the /i modifier so that hex digits can be represented in either lower or upper case. And in the second example, quantifiers were used to factor out the unnecessary repetition.
Update: Fixed quantifier on last term.
Dave
In reply to Re: Long regexp un multiple lines
by davido
in thread Long regexp un multiple lines
by Lorand
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |