Option, dass der Benutzername nicht mit alphanumerischen Zeichen beginnen oder enden muss

I’ve once spoken with someone about ruby. Is this doable with a plugin? I heard him mention I can override functions, such as in this case the validator. Is this correct?