import re


def sanitize_username(username: str) -> str:
    """
    Remove non-word characters from a username
    :param username: The username to sanitize
    :return: The sanitized username
    """
    illegal_chars = r'[^\w]'
    return re.sub(illegal_chars, '_', username)