|Perl: the Markov chain saw|
Regex overlap in MAC addressby superfrink (Curate)
|on Sep 11, 2006 at 19:15 UTC||Need Help??|
superfrink has asked for the
wisdom of the Perl Monks concerning the following question:
I have a list of MAC addresses from two sources that I want to unique and sort. I discovered that some of the address do not have zero padding and some do. I ran into a problem trying to use a regex to zero pad a MAC address.
My sample MAC:
The regex I tried was:
This gave me:
My guess is there is an overlap problem because the regex matches and replaces the : charater and so the : is not available to be mactched for the "4" because it was already used by the "b".
I thought about it for a bit and got around the problem without using a regex.
Can someone explain why the regex did not work as I expected or how to make it work as desired?