Allow Underscores at the start and end of Usernames : <p>Looking to see how I can edit the Username creation process to allow underscores and hyphens at the beginning and end of usernames.</p>

<p>Currently, if you end your username with a _, it drops it from the creation process.</p>

<pre><code>$regex = '/^[A-Za-z0-9]+[A-Za-z0-9_.]*[A-Za-z0-9]+$/';
if(!preg_match($regex, $_POST['username'])) {
        $_SESSION['error'][] = $language-&gt;register-&gt;error_message-&gt;username_characters;
    }
</code></pre>
