def _element_to_regex(self, element, job_directory, join_on):
        tag = element.tag
        method_name = "_%s_to_regex" % tag
        try:
            method = getattr(self, method_name)
        except __HOLE__:
            raise NameError("Unknown XML validation tag [%s]" % tag)
        regex = method(element, job_directory)
        if self.__is_true(element.get("single_quote", "false")):
            regex = r"'%s'" % regex
        if self.__is_true(element.get("double_quote", "false")):
            regex = r'"%s"' % regex
        min_count = int(element.get("min", "1"))
        max_count = int(element.get("max", "1"))
        assert max_count > 0
        if min_count != 1 or max_count != 1:
            single_regex = r"(?:%s)" % regex
            first = "%s%s" % (single_regex, "?" if min_count == 0 else "")
            rest = r"(?:%s%s){%d,%d}" % (join_on, regex, max(min_count - 1, 0), max_count - 1)
            regex = "%s%s" % (first, rest)
        return regex
dataset/ETHPy150Open galaxyproject/pulsar/pulsar/tools/validator.py/ExpressionValidator._element_to_regex