Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: finding urls in a string

by esskar (Deacon)
on Apr 07, 2004 at 16:09 UTC ( #343319=note: print w/replies, xml ) Need Help??


in reply to finding urls in a string

hi. my snippet does a little bit more but you can proably easy change it so it fullfills your needs
#! /usr/bin/perl use strict; use warnings; use URI::Find::Schemeless; use HTML::Entities qw(encode_entities); my $text = q~ hallo dies ist keine.url dies ist aber eine: www.intertivity.com ftp.irgendwas.de/test/thisfile mailto:perl@intertivityNOSP4M.com od +er so yeah perl@intertivityNOSP4M.com http://www.intertivity.com/ ~; my $finder = URI::Find::Schemeless->new ( sub { my ($uri, $originalUri) = @_; return q/<a href="/ . encode_entities("$uri") . q/">/ . encod +e_entities($originalUri) . q~</a>~; } ); my $howManyFound = $finder->find(\$text); print "$howManyFound URIs found\n"; print "$text\n";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://343319]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2023-03-24 19:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (61 votes). Check out past polls.

    Notices?