activeperl@listserv.ActiveState.com
[Top] [All Lists]

Re: Stupid RE question.

Subject: Re: Stupid RE question.
From: "$Bill Luebkert"
Date: Mon, 27 Dec 2004 14:43:47 -0800
Paul Appleby wrote:

> Michael,
> 
> This might be safer:
> 
> $line=~/^([^-]*?)-/;
> 
> $everything_to_first_hyphen=$1;

Why would that be ?  And safer than what (you removed the RE you were
referring to) ?  The ? is redundant and I don't see why [^-]* would be
any safer than .*?- (I might use either).

>>I'm sure this is obvious, but I'm missing it - What's the regular
>>expression to extract everything from the start of the line to the
>>first hyphen? 


-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:dbecoll@xxxxxxxxxxxx
 (_/   /  )    // //       DBE Collectibles    Mailto:dbe@xxxxxxxxx
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
ActivePerl mailing list
ActivePerl@xxxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

<Prev in Thread] Current Thread [Next in Thread>