Can you clarify more?
Where do you have the source string for process? Read it from a file to variable? Copy it to the clipboard?
Also, how do you want the result to be formatted? Capture the one last name at a time and do something, then the 2nd last time, or capture them all together, separated with ,, ;, tab, linefeed?
Oh, yes, that is another pattern. But, I was thinking it would be the same pattern to the first one: Carol Padden because the first author is set as "FirstName LastName".
The focus is only on the first author.
I am hopping that the macro will be able to capture exactly the last name of the first author every time I run it.
To clarify the background, I am trying to scrap references from Table of contents of Edited books. The names come in different patterns. I want to put the LastName of the First author as my CitationKey. that is why I want to get that one only.
In the screenshot, I was trying to capture "Tkachman". But, I am getting "Sandler".
They are different to computer. In the first case, the last name is followed by a comma ,.
In your screenshot, it is followed by ░And (there is a space before `And.
Try this macro below. It works with all the patterns you've posted. If there is yet another pattern, let us know.