in reply to Regex to match file extension in URL
I hope that helps.#!/usr/bin/perl -w use strict; my $var = 'http://www.foo.bar/baz/some.html'; ($var =~ / ^ # match the beginning [\w|\.|:|\/]+ # match chars, '.', '/', or ':' \w+\. # match file name followed by dot (\w+(?=$)) # match extension if followed # by the end of line /x) , my $match = $1; print $match . "\n";
|
|---|