in reply to regexp to get path from URL
If you *know* the path is sane, you might do something like this:
(my $path = $ENV{HTTP_REFERRER}) =~ s!//(.+?)/[^/]+\?*?!$1!;
I would rather have a module do it, though I've also split on the forward slashes...
Update: In the interests of historical accuracy, I'll simply humour Ovid by providing a more workable regex:
(my $path = $ENV{HTTP_REFERER}) =~ s!\.\w+/(.+?)/[^/]+\?*?!$1!;
This is your brain on work.
|
|---|