Strip non-alphabetic or newline characters from a given string.

    It can be used as a HTML element ID (also with jQuery and in all browsers).

    :param dirty: the string to wash
    :returns: the HTML ID ready string

def wash_html_id(dirty):
    """Strip non-alphabetic or newline characters from a given string.

    It can be used as a HTML element ID (also with jQuery and in all browsers).

    :param dirty: the string to wash
    :returns: the HTML ID ready string
    """
    import re
    if not dirty[0].isalpha():
        # we make sure that the first character is a lowercase letter
        dirty = 'i' + dirty
    non_word = re.compile(r'[^\w]+')
    return non_word.sub('', dirty)