Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Slurping file using regular expressions for array or variables

by kennethk (Monsignor)
on Apr 03, 2014 at 22:03 UTC ( #1081019=note: print w/ replies, xml ) Need Help??


in reply to Slurping file using regular expressions for array or variables

You failed to close your code tags. This has caused some rather dramatic mangling. Please correct this, and wrap your input in code tags as well, since white space gets mangled in HTML. See How do I post a question effectively?.

Your MAC address code should read

/([\dA-Fa-f]{2}:[\dA-Fa-f]{2}:[\dA-Fa-f]{2}:[\dA-Fa-f]{2}:[\dA-Fa-f]{2 +}:[\dA-Fa-f]{2})/g);
or more concisely,
/([\dA-F]{2}(?::[\dA-F]{2}){5})/ig);
The code you posted (I think) was looking for literal '2's instead of a count ({2}). See Quantifiers in perlre.

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.


Comment on Re: Slurping file using regular expressions for array or variables
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2014-09-22 06:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (182 votes), past polls