Compute the number of regexp match groups when the pattern is provided
        to the :func:`Cardinality.make_pattern()` method.

        :param pattern: Item regexp pattern (as string).
        :return: Number of regexp match groups in the cardinality pattern.

def compute_group_count(self, pattern):
        """Compute the number of regexp match groups when the pattern is provided
        to the :func:`Cardinality.make_pattern()` method.

        :param pattern: Item regexp pattern (as string).
        :return: Number of regexp match groups in the cardinality pattern.
        """
        group_count = self.group_count
        pattern_repeated = 1
        if self.is_many():
            pattern_repeated = 2
        return group_count + pattern_repeated * pattern_group_count(pattern)