Compare multiple text fragments against another list and get index

Hi,

Question:

We have input ist A. --> containing a couple of text items

We have list B --> containing a list of all possible text combinations (present in A)

Question:

  1. I would like to find the ‘same’ characters --> list A–>list B

  2. secondly I would like to retrieve the index, of the item in list B;

So for example:
List A List B = index wanted list C
FC --> FC = index 1. 1
G --> G = index 10. 10
B --> B = index 5. 5

Any suggestions?

2020-09-27 Find text item and index.gh (7.1 KB)

Just use Member Index.


2020-09-27 Find text item and index_re.gh (7.3 KB)

Hi, HS_Kim,

Thank you for your answer.
It does exactly what I asked to do :).

Unfortunately I came to the conclusion that there are also ‘other’ situations possible whereby this will not do the trick;

It is in fact possible that the part I want to replace is only a small part of a bigger piece of text.
This while I would like to ‘only’ and directly replace that part;

So for instance;
FD → 0
FC to C → 1 to 6
FA,G → 3,10

so ‘only’ replace all the text which is present in List B, but keep all the other ‘text’.

I found a piece of python script which does the thing correctly for ‘single’ Letters A-Z, but unfortunately not for combined letters like FD.

Do you have any suggestions?

Thank you in advance :slight_smile:

2020-09-27 Find text item and index v2.gh (11.3 KB)

maybe we only have to make a small python script adjustment?
image