#!/usr/bin/perl
use strict;
my $string = q{
An email address is foo-master@bar.com, but
this http://foo@bar.com/ and
this ftp://foo:baz@bar.com/ are
not emails.
};
my $desired_output = q{
An email address is foo-master@bar.com", but
this http://foo@bar.com/ and
this ftp://foo:baz@bar.com/ are
not emails.
};
foreach($string){
# make http or ftp hyperlinks first
s#((ht|f)tp://[\S]+)#$1#isg;
# now make email addresses hyperlinks
# but don't "email-ify" http or ftp URIs
s#((?$&#isg;
if( m#(?##
Yes, it matches (foo-master@bar.com).
An email address is foo-master@bar.com, but
this oo@bar.com/">http://foo@bar.com/ and
this baz@bar.com/">ftp://foo:baz@bar.com/ are
not emails.