Skip to content

Instantly share code, notes, and snippets.

@onevcat
Created August 4, 2012 05:09
Show Gist options
  • Select an option

  • Save onevcat/3254713 to your computer and use it in GitHub Desktop.

Select an option

Save onevcat/3254713 to your computer and use it in GitHub Desktop.
Find and Replace urls in plain text with Perl(Schemeless)
use URI::Find;
sub replaceURL {
my $data = shift @_;
require URI::Find::userContentFile;
my $finder = URI::Find::Schemeless->new(
sub {
my($uri, $orig_uri) = @_;
return qq|<a href="$uri">$orig_uri</a>|;
}
);
$finder->find( \$data );
return $data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment