ramthen has asked for the wisdom of the Perl Monks concerning the following question:
hello Monks,
I seek your advise on the following situtation.
I need to extract filename and the dir path in which this filename is located. This has to be done from the root-level of a particular dir.
In the script that am writing, I followed this regex to extract the dirname and filename.
$abspath =~ /\/\w+(.txt|.doc|.pdf|.vsd|.xls|.xlt|.dot|.pot|.ppt|.mpp)$/;
with thie regex, the following are matched :
Framework/Templates_Doc.Conventions/CSSP_TPL_Process_Procedure_Description.xls
Framework/Templates_Doc.Conventions, , /CSSP_TPL_Training_Material.pot
but the following are not matched.
Framework/Templates_Doc.Conventions/CSSP_TPL_Excel_Meta-Template.xlt
Engineering/SBI/PD_PRC/Overall_SWReleaseFlow_v0.1.vsd
Could you pls. share your wisdom on how to solve this regex ?
thanks in advance,
Mars
2005-11-10 Retitled by planetscape, as per Monastery guidelines
Original title: 'regular expression on filenames with aboslute path'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regular expression on filenames with absolute path
by Aristotle (Chancellor) on Nov 05, 2005 at 11:54 UTC | |
|
Re: regular expression on filenames with absolute path
by Samy_rio (Vicar) on Nov 05, 2005 at 10:17 UTC | |
|
Re: regular expression on filenames with absolute path
by sh1tn (Priest) on Nov 05, 2005 at 11:38 UTC | |
by ramthen (Sexton) on Nov 07, 2005 at 15:37 UTC | |
|
Re: regular expression on filenames with absolute path
by ioannis (Abbot) on Nov 05, 2005 at 10:32 UTC | |
|
Re: regular expression on filenames with absolute path
by TedPride (Priest) on Nov 05, 2005 at 10:49 UTC |