'Generate the regexes used to match against fields.'

def get_match_patterns(self, values):

    self.match_fields = set()
    match_patterns = {}
    for key in values:
        parsed_key = self.parse_match_fields_key(key)
        self.match_fields |= parsed_key['fields']
        match_values = values[key]
        if (not match_values):
            continue
        if (not isinstance(match_values, list)):
            match_values = list((match_values,))
        match_values = [unicode(val) for val in match_values]
        if ('regex' not in parsed_key['modifiers']):
            match_values = [re.escape(val) for val in match_values]
        value_str = (u'(%s)' % '|'.join(match_values))
        for mod in parsed_key['modifiers']:
            if (mod in self._match_regexes):
                match_mod = mod
                break
        else:
            if (len(parsed_key['fields']) == 1):
                field = list(parsed_key['fields'])[0]
                if (field == 'domain'):
                    value_str = (u'(?:.*?\\.)?' + value_str)
                match_mod = self._match_field_defaults.get(field, 'includes-word')
            else:
                match_mod = 'includes-word'
        pattern = (self._match_regexes[match_mod] % value_str)
        flags = (re.DOTALL | re.UNICODE)
        if ('case-sensitive' not in parsed_key['modifiers']):
            flags |= re.IGNORECASE
        try:
            match_patterns[key] = re.compile(pattern, flags)
        except Exception as e:
            raise AutoModeratorSyntaxError(('Generated    an    invalid    regex    for    `%s`:    %s' % (key, e)), self.parent.yaml)
    return match_patterns
