import re


def is_username_valid(username):
    """
    Check if a username is valid.

    :param username: The username to validate.
    :return: True if the username is valid; False otherwise.
    """
    valid_username_regex = re.compile('^[a-zA-Z0-9\-_]+$')
    return bool(re.match(valid_username_regex, username))