For Each Item in a Collection Set New Unique Variable for Each Iteration

Hello. I apologize if this is so basic but I've been back and forth between the forum and the wiki and trying things and I can't figure it out.

What I want to do is simple: For each item that matches a Regex string I want to create a unique variable with a number after it that corresponds to the iteration in which it was found.

For instance in a document Regex isolates:

Smith, John
Rogers, Charlie
Jones, Tyler

I would like these names to be saved in separate variables to be used afterwards.

Ptname1= Smith, John
Ptname2= Rogers, Charlie
Ptname3=Jones, Tyler

So simple but maddeningly can't figure it out.

image

Hey Jordan,

Look over this thread:

Store Values in Dynamically Created Variables?

I don't like the dictionary method myself, but YMMV.

In any case – there is at least one example doing specifically what you want without the looping context.

Store Values in Dynamically Created Variables? - #6 by peternlewis

-Chris

1 Like

Thanks Chris. As usual, very helpful.

1 Like