[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Easy regex?



At 8:32 AM -0800 12/17/98, Scott, Lachlan wrote:
>> $orig_path =
>> "server.mydomain.de/directory1/directory2/irritating_filename.pl";
>>
>> and I want
>>
>> $desired_path ="server.mydomain.de/directory1/directory2/";
>>
>> the number of directories and their names is variable; the name and of
>>the
>> irritating file and the length of it's name may change, but for the time
>> being assume *.pl

if ($orig_path =~ m@/[^/]+\.pl$@) {
  ($desired_path = $orig_path) =~ s@/[^/]+$@@;
} else {
  # error...
}
--
Rich Morin:          rdm@cfcl.com, +1 650-873-7841, http://www.ptf.com/~rdm
Prime Time Freeware: info@ptf.com, +1 408-433-9662, http://www.ptf.com
MacPerl: http://www.ptf.com/macperl,   http://www.ptf.com/ptf/products/MPPE
MkLinux: http://www.mklinux.apple.com, http://www.ptf.com/ptf/products/MKLP

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch