@staticmethod
def decomposeExpression(expression):
    """Converts the given expression pattern into a list of 'chunks' that
		are tuples (t, chunk), where 't' is 'u' when the chunk is a litteral
		url, 'v' when the chunk is a variable, and 'uo' or 'vo' when the chunk is
		optional."""
    length = len(expression)
    offset = 0
    chunks = []
    while offset < length:
        var_group = expression.find('{', offset)
        opt_group = expression.find('[', offset)
        if var_group == opt_group == -1:
            chunks.append(('u', expression[offset:]))
            break
        if var_group == -1:
            var_group = length + 1
        if opt_group == -1:
            opt_group = length + 1
        if var_group < opt_group:
            if var_group != offset:
                chunks.append(('u', expression[offset:var_group]))
            end_offset = expression.find('}', offset)
            name = expression[var_group + 1:end_offset].split(':')[0]
            chunks.append(('v', name))
            offset = end_offset + 1
        else:
            raise Exception('Optional groups not supported yet')
    return chunks
