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";
In reply to Re: Regex to match file extension in URL
by enoch
in thread Regex to match file extension in URL
by Amoe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |