How to restrict allowed username characters during registration?

Is there a configuration menu somewhere or can this only be done with a rule?

Hi,

Welcome to Community,

Would you please share more details, what exactly you want. I mean you want to limit number of characters or want to block specific characters?