I have a list:
oldList = {"a-1", "b", "c", "a-2", "d", "e", "f", "a-3", "w"}
and would like to get the following list:
newList = {{a-1,b}, {a-1,c}, {a-2,d}, {a-2,e}, {a-2,f}, {a-3,w}}
I see that there was a similar but not identical question was posed here four years ago. I started by using StringMatchQ and Position to find the position of the elements that contain "-" and then Complement to find which elements need to have the terms containing "-" affixed to them. But Insert doesn't seem to be very flexible and I'd like to avoid a bunch of For loops.