in reply to Regex overlap in MAC address

Update: Thanks Skeeve for pointing out that error, it is now fixed.
$ perl -le' $mac = "0:13:46:b:4:31"; $mac =~ s/([^:]+)/ sprintf "%02x", hex $1 /eg; print $mac; ' 00:13:46:0b:04:31 $ perl -le' $mac = "0:13:46:b:4:31"; $mac = join ":", map sprintf( "%02x", hex ), split /:/, $mac; print $mac; ' 00:13:46:0b:04:31

Replies are listed 'Best First'.
Re^2: Regex overlap in MAC address
by Skeeve (Parson) on Sep 11, 2006 at 20:28 UTC
    Didn't you notice that it fails for hex digits a-f? use "%02s" instead.

    s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
    +.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e