Created
August 4, 2012 05:07
-
-
Save onevcat/3254692 to your computer and use it in GitHub Desktop.
Find and replace the email address in plain text with Perl
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 Email::Find; | |
| sub replaceEmail { | |
| my $data = shift @_; | |
| my $finder = Email::Find->new( | |
| sub { | |
| my($email, $orig_email) = @_; | |
| my($address) = $email->format; | |
| return qq|<a href="mailto:$address">$orig_email</a>|; | |
| } | |
| ); | |
| $finder->find(\$data); | |
| return $data; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment