First of all, its not a big problem.
I have created a custom registration form. For the username field I have used the sanatizer api before storing the username in the database.
$username is the variable from the form input after submit (Post)
I sanatize it like this:
In the guidelines th...