http://www.perlmonks.org?node_id=928346


in reply to RegEx is required for the below pattern

You can start with File::Basename module.