[Nh-pm] Regexp help

pll at lanminds.com pll at lanminds.com
Thu Feb 27 14:37:26 CST 2003


Hi,

I'm trying to match a MAC addr in perl with a regex.  This is what 
I've got so far:

	((([0-9A-F]{2}):){5}$1)

But when I do something like

	$foo = s/.*((([0-9A-F]{2}):){5}$1).*/$1/g ;
	print "$foo\n";

I get the first 5 octets followed by a ':' like this:

	00:E0:81:02:2E:

What am I missing?

There's got to be something really subtle here I'm not quite getting.
Should I be using '?' in there somewhere (something I've never quite 
understood :)

(yes, I know there's a Regexp::Common::net module I could use, but I 
just need something quick and dirty, and don't want to require an 
external dependancy just yet if I don't need to)


Thanks,
-- 

Seeya,
Paul
--
Key fingerprint = 1660 FECC 5D21 D286 F853  E808 BB07 9239 53F1 28EE

	It may look like I'm just sitting here doing nothing,
   but I'm really actively waiting for all my problems to go away.

	 If you're not having fun, you're not doing it right!





More information about the Nh-pm mailing list