Re: match file name at end of a http url



Hello,

I tried this and worked.
Please let me know in case you find any bugs in this
:)


$url="http://dev.catalyst.perl.org/wiki/YetAnotherCatalystIntro";;
if( $url =~ /\/([\w.]*$)/ ){
print $1;
}
else{
print "No Match";
}

Regards
Nishanth

--- Tom Phoenix <tom@xxxxxxxxxxxxxx> wrote:

On 4/25/06, John Ackley <john@xxxxxxxxxx> wrote:

if( $url =~ /\/(.*$)/ )

then characters after last / are found in $1

Unfortunately, characters after the first slash are
in there, too.

To process a URL requires more than a simple pattern
match. Use a
module from CPAN. Cheers!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail:
beginners-unsubscribe@xxxxxxxx
For additional commands, e-mail:
beginners-help@xxxxxxxx
<http://learn.perl.org/>
<http://learn.perl.org/first-response>





__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
.



Relevant Pages

  • Re: kernel panic installing 5.4-release
    ... be a mature enough distribution by now that any bugs ... Why are you installing a version of FreeBSD that is ... Do You Yahoo!? ... Mail has the best spam protection around ...
    (freebsd-questions)
  • Re: [PATCH] include/linux/slab.h: new KFREE() macro.
    ... succeeded for a pointer, else return ENOMEM. ... There are bugs with this approach. ... Do You Yahoo!? ... Mail has the best spam protection around ...
    (Linux-Kernel)
  • Re: enough
    ... I don't see how the list admin would not let some messages through when everything else posted by our colourful cast of characters does. ... Do You Yahoo!? ... Mail has the best spam protection around ...
    (soc.genealogy.britain)
  • Re: [MISC] Plot vs. Character
    ... different characters point-of-view in each album. ... Do You Yahoo!? ... Mail has the best spam protection around ...
    (rec.arts.comics.creative)
  • Re: What will you be hunting with this Fall?
    ... > a rear sight and a slightly prouder front sight than ... > add a forward sling loop and a sling button toward the ... > Do You Yahoo!? ... Mail has the best spam protection around ...
    (rec.hunting)