Created
August 4, 2012 05:09
-
-
Save onevcat/3254713 to your computer and use it in GitHub Desktop.
Find and Replace urls in plain text with Perl(Schemeless)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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