import re


def num_occurrences(text, pattern):
    """
    Extract number of occurences of a pattern in text
    :param text: a string represet text
    :param pattern: a regex pattern
    :return: Integer indicates number of occurrences
    """
    return len(re.findall(pattern, text))