import re


def consonants(s):
    """Takes a string s, returns the integer count of consonants in the
    string. Compiling the pattern so I can use a flag.
    """
    r = re.compile('[^BCDFGHJKLMNPQRSTVWXZ]', re.IGNORECASE)
    count = len(re.sub(r, '', s))
    return count