Do you have the complete URI in a single string or do you
have it in a text? The first is quite simple:
($file) = $uri =~ /^.*\/(.*)$/;
You might end up with an empty
$file if the
URI ends in a / (and therefore uses the default index file).
The later is more complicate, for you have to keep different
things in mind:
- You should change the class of allowed characters to
something more strict, to just the allowed characters that
are defined in the
URI RFC.
- On the other hand people tend to put allowed
URI-characters behind their URIs. Usual character in that
range include the dot (`.'), closing brackets (`)') and coma
(`,'). Also quotation marks fall in that range. So you
should add a 1-character wide character class at the end
that doesn't include those, too.
There might be other things that I haven't thought about
yet, but I hope you get the image...
--
Alfie