I have a list with a custom separator. I want to do something with each item in the list. Similar to the collections for Dictionary Keys and JSON Keys I'd like a List Values collection.
I know it's already possible, but (unless I'm just flat missing something, which is very possible) I usually use a number range as an index counter and extract each item from the list, but using %Variable%ListName[index]Custom_Sep% is prone to typo errors compared to %Variable%Local_ListItem%
The UI I'm thinking of is similar to the substrings collection, except instead of a regex you just put the separator character (default to ,). Ignoring case goes, variable is the List Variable, as string goes.
Ah, that's a good idea unfortunately the list items for the situation that made me think of this may contain LF characters in them.
In fact my custom separator is actually , which is in the running to be the least used emoji, just because the contents of the items can contain , or every other ASCII character I thought of using (I usually use tab)
Your regex is not a generic array item extractor. It only works for me when the separator is followed by a LF, which is more along the lines of what @JMichaelTX was suggesting. It doesn't work with lists that are just, like in most of the examples in the wiki, comma separated value lists.
The use case for my proposal is any time you want to loop over a list of items connected with a separating character. The reason I think it's better is that it is significantly easier to use, especially for one of KM's target markets of non-programmers.
Writing a new regex every time you want to do this and your list contents might be different than you've previously done -- sucks. Using a bunch of actions to support extracting by the number range, sucks. Replacing the separator with a carriage return & using the By Line for-each construct is probably the simplest and works, I expect, in the majority of cases, but even that is complicated by needing extra actions to change the list separator.
My proposal does it all in a single action that involves no modification to the list, supports all constructs where item values are anything, except the list separator and any separator that doesn't appear in the item value. The current way of extracting item values 1 at a time doesn't support escaping the separator character, and this should follow the same rule.
Here's an example macro with the different test scenarios I came up: