import re


def alphanumerical(string):
    """
    A function to filter a string to only allow alphanumerical characters.
    """

    pattern = re.compile('[^a-zA-Z0-9]+')
    return pattern.sub('', string)