$re = '/(?<=^|\s)(?:(\w*\')?)(@(\S+))/m';
$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';
$subst = "<a href=\"/user/$3\">$2</a>";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
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 PHP, please visit: http://php.net/manual/en/ref.pcre.php