Dirk Bremer wrote:
Added my version of re as RE2 and modified your test slightly to
produce the results below. RE1 fails on /'s in the path. parse
and RE1 have a problem when there is no '.' - the problem being
how do you tell 'fubar' from 'fubar.' ? RE1 also fails to find
'fubar'.
This tests
In a character class put the - first so it's not interpreted as a range.
[-\w\._\s]
At 05:11 PM 4/21/05 -0500, Dirk Bremer wrote:
>False [] range "_-\s" before HERE mark in regex m/\\([\w\._-\s << HERE
>]+)$/ at C:\Perl\Scripts\regex.pl line 7.
>>CompID.properties<
--
REMEMBER THE WORLD TRAD
The offset of the last element in an array is $#array. So $array[$#array]
is the last value.
At 03:58 PM 4/21/05 -0400, Chris wrote:
>> $s1 = "c:\\temp\\foo.pl";
>> $barename = (split( /\\/, $s1)[2]; # $barename gets "foo.pl"
To do it in one shot you can do:
$last = (reverse (split /\\/, $s1)
ut of any of these three
subroutines or can offer one that will do better, I would like to know.
-Original Message-
From: Dirk Bremer
Sent: Thursday, April 21, 2005 16:37
To: '[EMAIL PROTECTED]'; Chad I. Uretsky
Cc: [EMAIL PROTECTED];
'activeperl@listserv.ActiveState.com
> I've got this problem: pulling the bare filename off of a fully pathed
string, using split. The tricky part is getting the > last element in the
array when I don't know how many members are in it. Example:
> $s1 = "c:\\temp\\foo.pl";
> $barename = (split( /\\/, $s1)[2]; # $barename gets "foo.