[Nh-pm] Regexp help

Kevin D. Clark kclark at CetaceanNetworks.com
Fri Feb 28 17:34:02 CST 2003


Paul Lussier <pll at lanminds.com> writes:

> First we've got:
> 
> 	( gobbldeygook ) more_gobbledeygook
> 
> The stuff within the parens will be saved as $1, correct?

No, but in a later paragraph you explain why this isn't so.

> Then, we have within the ()'s:
> 
> 	?:[[:xdigit:]]{2}:
> 
> I'm a little lost onthe '?:'

No, I don't think that you're lost.

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

Yup.

> 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?

Yes, I just used the (?:pattern) construct for grouping, not capturing.

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

Exactly.

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

Yes, that's it exactly.


Hope this helps!

--kevin
-- 
Kevin D. Clark / Cetacean Networks / Portsmouth, N.H. (USA)
cetaceannetworks.com!kclark (GnuPG ID: B280F24E)
alumni.unh.edu!kdc




More information about the Nh-pm mailing list