[Nh-pm] Regexp help

Paul Lussier pll at lanminds.com
Fri Feb 28 15:35:07 CST 2003


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

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

Okay, I've stared at this until my brain hurts, and I can't quite be 
sure I understand what's going on here.  I think I've got it, but I'm 
not sure, so please correct me where I'm wrong :)

First we've got:

	( gobbldeygook ) more_gobbledeygook

The stuff within the parens will be saved as $1, correct?

Then, we have within the ()'s:

	?:[[:xdigit:]]{2}:

I'm a little lost onthe '?:' but the '[[:xdigit:]]{2}:' I'm pretty 
sure is "Any hex digit twice followed by a :".

Now, the '?:', according to perldoc perlre states:

"(?:pattern)"
"(?imsx-imsx:pattern)"
                 This is for clustering, not capturing; it groups
                 subexpressions like "()", but doesn't make back-
                 references as "()" does.

So, I'm assuming that this means the match isn't assigned to one the
the $digit vars?

Then we've got that mess 5 times, followed by a 2 more hex digits, right?

Okay, I think that makes sense.  And, if I place the *entire* thing 
into ()s, I get $1 assigned to that?

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