<commit_before>"""
I do not using re.I flag in regexps because of current locale does not affect
on it. So the solution is to make both searchable text and regexp in lower case.
"""
import re
import locale

from django.utils.html import strip_tags

from tagging.models import Tag

CACHE = {}

def build_regexp(value, exact):
    value = value.lower()
    if exact:
        value = u'\b%s\b' % value
    return re.compile(ur'%s' % value, re.U)

<commit_msg>Ignore case in filtering by tag/words<commit_after>"""
I do not using re.I flag in regexps because of current locale does not affect
on it. So the solution is to make both searchable text and regexp in lower case.
"""
import re
import locale

from django.utils.html import strip_tags

from tagging.models import Tag

CACHE = {}

def build_regexp(value, exact):
    value = value.lower()
    if exact:
        value = u'\b%s\b' % value
    return re.compile(ur'%s' % value, re.U | re.I)


{'fraction_non_alphanumeric': 0.09437963944856839, 'fraction_numerical': 0.0, 'mean_word_length': 3.411214953271028, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1505049', 'n_tokens_mistral': 299, 'n_tokens_neox': 294, 'n_words': 124}