'Parses the patterns and creates a tuple with the compiled regex pattern and the variables it produces
:param patterns: list of regex patterns as .tracker XML
:return: list of (regex, variables, optional)-pairs'

def parse_patterns(self, patterns):

    result = []
    for pattern in patterns:
        rx = re.compile(pattern.find(u'regex').get(u'value'), (re.UNICODE | re.MULTILINE))
        vals = [var.get(u'name') for (idx, var) in enumerate(pattern.find(u'vars'))]
        optional = (True if (pattern.get(u'optional', u'false').lower() == u'true') else False)
        result.append((rx, vals, optional))
    return result
