[Nh-pm] Regexp help

Paul Lussier pll at lanminds.com
Thu Feb 27 15:50:07 CST 2003


In a message dated: 27 Feb 2003 16:34:43 EST
Kevin D. Clark said:

>In some sense, I can see what you're trying to do with the "$1", but
>you should know that if you're trying to do something like this, then
>you need to use \1 instead of $1 (due to how internals of the Perl
>machine works...).  But you're fundamentally using this wrong anyways
>(\1 will match whatever the regex engine matches, not the actual regex
>itself)

I figured I was missing something fundamental, like understanding how 
the regex engine really works :)

>How about this instead?:
>
>  (?:[[:xdigit:]]{2}:){5}[[:xdigit:]]{2}

Just need one more set of () :

	((?:[[:xdigit:]]{2}:){5}[[:xdigit:]]{2})

This here works just fine:

	s/.*((?:[[:xdigit:]]{2}:){5}[[:xdigit:]]{2})/\1/o

Thanks much!
-- 

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