On Fri, Jul 20, 2001 at 05:19:23PM -0500, [EMAIL PROTECTED] wrote:
> i have:
> 
> my $version = '$Revision: 1.47 $';
> $rcs =~ s/[^\d.]+//;
> 
> looking at the regex match, i would think this should match all
> non-numeric and \. characters. however, the value of $rcs ends up as:
> 
> 1.47 $
> 
> i am not sure why the \s and \$ after the numbers are not being wiped out.

Because there's no /g on your s///.  '$Revision: ' is the first occurence of
the pattern [^\d.]+, the substitution stops after replacing that.

The typical idiom for this is:

    my($rcs) = (q$Revision: 1.47 $ =~ /(\d+(?:\.\d+)+)/);


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to