htmanning has asked for the wisdom of the Perl Monks concerning the following question:
I"m trying to grab the current URL, and find a page number at the end. The URL is like the following:
http://www.domain.com/sub/name/anothername/page2/
http://www.domain.com/sub/name/anothername/page3/
http://www.domain.com/sub/name/anothername/page4/
I'm trying to set the page number to a var. I tried this, but the .* takes out the page# too.
$current_url = $ENV{REQUEST_URI}; $current_url =~ s/\/sub-dir\/name/.*\///;
I'm trying to end up with the page number only.
Thanks,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Stripping part of URL
by graff (Chancellor) on Mar 24, 2015 at 02:12 UTC | |
by htmanning (Friar) on Mar 24, 2015 at 03:35 UTC | |
by mark4 (Acolyte) on Mar 24, 2015 at 14:57 UTC | |
|
Re: Stripping part of URL
by Anonymous Monk on Mar 24, 2015 at 02:04 UTC | |
|
Re: Stripping part of URL
by jeffa (Bishop) on Mar 24, 2015 at 15:29 UTC |