By default, Drupal 9 allows usernames to have spaces, periods(.), hyphens(-), apostrophes('), underscores(_) and @ symbols.

How would I disallow spaces, periods, apostrophes and @ symbols?


1 Answer 1


I used the Username Validation module suggested by Patrick Kenny in his comment. The Blacklist characters field shown by the module on /admin/config/people/user-name-validation did the trick.

  • There are also a LOT of other questions on here that ask the same or similar question. See the "Related" block to the right ->
    – anonymous
    Feb 9, 2022 at 6:02
  • All of those questions are outdated or have nothing to do with the question of disallowing characters. I did search the website first before posting. Now admittedly, I didn't search "validation" when googling, which is probably why I didn't find the module that solved my problem.
    – cofihouse
    Feb 9, 2022 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.