Matching index between two lists with sublists for every elements of sublists

Hi folks,

On one side I have a list1 with sublists and in the other side another list2 with sublists too.
I am trying to get the index of each element of each sublist of list2 in the corresponding sublist of list1 ? The result expected will be a list(3) with the same structure of sublist as list (2).

I try several combinations but nothing seems to give the right output.

With List combine

WIth @Level

In my example, I would expect :
0
(0) 0
(1) 1
1
(0) 4
(1) 3
(2) 2

I have succeeded to do it when list(2) have no sublists

but can’t go forward, if I run with sublists…

You can use AllIndicesOf and flatten:

5 Likes

Thank you Einar!

It works perfectly !

1 Like