in reply to More Help with Regex
#!/usr/local/bin/perl -w use strict; $_ = '00a0c801adc6'; s/([\w]{2})(?!$)/$1:/gio, "\n<BR>"; print "$_\n<BR>";
to explain the regex,
all this assumes you don't have to untaint the mac address. otherwise, you'll want to do that before the s///.s/ ([\w]{2}) # matches a pair of letters/numbers (?!$) # matches NOT end of string (zero-width negative lo +okahead assertion) /$1:/giox; # replace pair with trailing colon
~Particle
|
---|