use strict;
my $str = '1. take this -> @Mark
2. take this -> @mark_2
3. take this -> @中国
4. take this -> l\'@antro
5. don\'t take this -> 中国@中国.zh
6. don\'t take this -> 中国@google.zh
7. don\'t take this -> info@google.com
8. don\'t take this -> 99@test.com
9. don\'t take this -> 99@user
10. don\'t take this -> %&@user
11. take this -> dell\'@altro
12. take this -> l'@mike';
my $regex = qr/(?<=^|\s)(?:(\w*')?)(@(\S+))/mp;
my $subst = '<a href="/user/$3">$2</a>';
my $result = $str =~ s/$regex/$subst/rg;
print "The result of the substitution is' $result\n";
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html