in reply to Regular Expression for MAC Address
When I run it, I get the following output#!/usr/bin/perl -w use strict; my $d = "[0-9A-Fa-f]"; my $dd = "$d$d"; while (<DATA>) { /($dd([:-])$dd(\2$dd){4})/o && print $1, "\n" } __END__ My MAC address is 00-00-00-00-00-00 over there, and it's 00:00:00:00:00:00 over here, and the date/time happens to be 2001-05-25-15:27. Note that 00:00-00:00-00:00 isn't really valid. Oh, and I have one address of DE:AD:BE:EF:21:12.
Note that it skipped the 4th sample line where the dashes 'n' colons are intermingled.00-00-00-00-00-00 00:00:00:00:00:00 DE:AD:BE:EF:21:12
xoxo,
Andy
%_=split/;/,".;;n;u;e;ot;t;her;c; ". # Andy Lester 'Perl ;@; a;a;j;m;er;y;t;p;n;d;s;o;'. # http://petdance.com "hack";print map delete$_{$_},split//,q< andy@petdance.com >
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Regular Expression for MAC Address
by marius (Hermit) on May 26, 2001 at 00:54 UTC | |
Regular Expression for MAC Address
by amitubale (Initiate) on Feb 27, 2003 at 22:37 UTC | |
by BrowserUk (Patriarch) on Feb 28, 2003 at 01:55 UTC |