Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Regular Expression for MAC Address

by MeowChow (Vicar)
on May 26, 2001 at 00:19 UTC ( #83413=note: print w/ replies, xml ) Need Help??


in reply to Regular Expression for MAC Address

Are you trying to extract the address or just check for a match?

To check for a match:

/^([0-9a-f]{2}([:-]|$)){6}$/i
To extract the address:
@nums = split /[:-]/, $mac;
To match and extract an address whole, from a line containting other text:
/((?:[0-9a-f]{2}[:-]){5}[0-9a-f]{2})/i
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print


Comment on Re: Regular Expression for MAC Address
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://83413]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (18)
As of 2015-07-01 15:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (6 votes), past polls