import re


def count_items_matches(text, item, regexp):
    """ Counts the number of occurences of the item in the text
    """
    expression = r'(^|%s)%s($|%s)' % (regexp, re.escape(item), regexp)
    pattern = re.compile(expression, flags=re.U)
    matches = re.findall(pattern, text)

    return len(matches)