That's a bit wordy, and you're using multiple regular expressions. If you make your regular expression a little more complex, you can do it like this:
my $url = "http://google.com/folder/1234.html"; my $numbers = $url; $numbers =~ s#^.*(\d+)[^/]*$#$1#; print $numbers;
...roboticus
When your only tool is a hammer, all problems look like your thumb.
In reply to Re^2: Strip part of url
by roboticus
in thread Strip part of url
by htmanning
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |