laziness, impatience, and hubris | |
PerlMonks |
regular expression on filenames with absolute pathby ramthen (Sexton) |
on Nov 05, 2005 at 09:43 UTC ( [id://505958]=perlquestion: print w/replies, xml ) | Need Help?? |
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
Back to
Seekers of Perl Wisdom
|
|