You could use [man]preg_match/man, with the idea that the name used would be alphanumeric and may have a dash after the first character.
A simple though incomplete example would be:
<?php
if (!empty($_GET['n'])) {
if (preg_match('/(.*)\@[a-z0-9][a-z0-9\-]*\.(com|net|org)/i', $_GET['n'], $matches) == 1) {
echo $matches[1];
}
} else {
echo '<a href="' . $_SERVER['PHP_SELF'] . '"?n=username@example.com">username@example.com</a>';
}
?>