[rt-users] regex for mac address
gleduc at mail.sdsu.edu
Wed Jun 2 17:44:47 EDT 2010
The format for MAC addresses is not standardized. I've seen them with
(Win, RedHat) and without (Solaris) leading zeros, colons (RH, Solaris)
or hyphens (Win) as separators, and uppercase (Win, RedHat) or lowercase
(Solaris) hex values. I think I've also seen network gear that shows
them as xxxx:xxxx:xxxx. It really depends on where the MAC info is
These may not be perfect, but you get the idea.
You could try normalizing the string by replacing all colons with
hyphens and then adding a leading zero to all single character values,
and then applying your regex.
On 6/2/2010 2:06 PM, Troy Knabe wrote:
> I am trying to do a regex for mac address verification. My first attempt
> looks like this, but did not work. Anyone have any insight as to what I
> am missing?
> Troy Knabe
> knabe at 4j.lane.edu <mailto:knabe at 4j.lane.edu>
More information about the rt-users