def get_registers_sequence(instruction, registers):
    """
    Read a Revlib instruction and get positions of the registers in the instruction.
    :param instruction: RevLib format instruction string
    :param registers: list of all registers of the Qiskit circuit
    :returns a list of registers positions in the circuit that involved in the instruction

    """
    result = []
    for command in instruction[1:]:
        for i, register in enumerate(registers):
            if command == register.name:
                result.append(i)
    return result