Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Regex To Remove File Extension

by Nkuvu (Priest)
on Dec 15, 2008 at 16:23 UTC ( [id://730444]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Regex To Remove File Extension
in thread Regex To Remove File Extension

Of course if you have a manageable list of extensions, you could populate the suffix list and use File::Basename very easily. That is, the original post says "extension might not always be txt," but that doesn't indicate the scope of potential extensions. Maybe it's just txt, html, htm, pl and cgi (just a random group of extensions chosen). In which case I'd lean towards the File::Basename solution rather than creating a regex unique to this script.

Or maybe the AnonyMonk means to be able to remove any extension, in which case File::Basename isn't the best solution. Obviously the AnonyMonk will need to choose the best approach, but I wouldn't discount File::Basename for a limited number of extensions.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://730444]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2026-01-16 00:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (118 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.