Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: A better way? Extracting filename from url

by flocto (Pilgrim)
on Jan 14, 2002 at 18:28 UTC ( [id://138566]=note: print w/replies, xml ) Need Help??


in reply to A better way? Extracting filename from url

An easy way to do this is this simple regexp:
my ($file) = $url =~ /\/([^\/]*?)(?:\?|$)/
This will work with host:port, directories and parameters given in the url. Hope this works for you..

-octo-
--
GED/CC d-- s:- a--- C++(+++) UL+++ P++++$ L++>++++ E--- W+++@ N o? K? w-- O- M-(+) V? !PS !PE !Y PGP+(++) t-- 5 X+ R+(+++) tv+(++) b++@ DI+() D+ G++ e->+++ h!++ r+(++) y+

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2024-03-29 00:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found