Returns all (random) terms whose named are derived from the
        specified string. For example, 'condition|subject' should match the
        terms with names '1|subject', 'condition[T.1]|subject', and so on.
        Only works for strings with grouping operator ('|').

def _match_derived_terms(self, name):
        '''
        Returns all (random) terms whose named are derived from the
        specified string. For example, 'condition|subject' should match the
        terms with names '1|subject', 'condition[T.1]|subject', and so on.
        Only works for strings with grouping operator ('|').
        '''

        if '|' not in name:
            return None

        patt = r'^([01]+)*[\s\+]*([^\|]+)*\|(.*)'
        intcpt, pred, grpr = re.search(patt, name).groups()

        intcpt = '1|%s' % grpr
        if not pred:
            return [self.terms[intcpt]] if intcpt in self.terms else None

        source = '%s|%s' % (pred, grpr)
        found = [t for (n, t) in self.terms.items() if n == intcpt or
                 re.sub('(\[.*?\])', '', n) == source]
        # If only the intercept matches, return None, because we want to err
        # on the side of caution and not consider '1|subject' to be a match for
        # 'condition|subject' if no slopes are found (e.g., the intercept could
        # have been set by some other specification like 'gender|subject').
        return found if found and (len(found) > 1 or found[0].name != intcpt) \
            else None