Brian, that's brilliant, thank you. It's for thumbnail text and image playback captions. The field data is nested keywords and I use the exclamation mark to ensure that the "folders" are listed first. It works well enough in a pane, but was not very friendly when used elsewhere.
The goal: If there's a caption, use that, if not, if there's an occasion, use that, if not, if there's a location, use that, otherwise, blank. I have that now, along with formatting that makes things a bit more viewer friendly...
ifelse(!isempty([caption]),[caption],!isempty([occasion]),if(isequal([occasion],!,8),regex([Occasion],/#!(.+)\\(.+)#/,-1,0)if(isequal([R1],\!,8),replace([R1],\!,/,/ ),[R1]): [R2],[occasion]),!isempty([location]),if(isequal([location],!,8),regex([location],/#!(.+)\\(.+)#/,-1,0)if(isequal([R1],\!,8),replace([R1],\!,/,/ ),[R1]): [R2],[location]),1,[caption])
For the few cases where the tree has gone two levels deep, I have worked a couple of replace expressions on [R1], and the job's a good 'un.
Brian, and mattkhan, thank you for replying. I'm reasonably fluent with MC expressions and when I see one, I can just read it and know what it's supposed to do. Try as I might, I just cannot seem to be able to get my head around regex. Loving these image captions now
-marko