Hello, @robin-cruise, and All,
I suppose that, if the sentence contains a single word, followed with a full stop like Paul., it should not be concerned by the replacement, ins’t it ?
So, the correct regex S/R is :
SEARCH (?-s)^(\w+)\b(.+)\b(\w+)\.$
REPLACE \3\2\1.
Notes :
The \b assertions ensure that the group \1 and group 3 contain true words, i.e. the first and last character of group 2 are non-word characters
In group 2 we just can use a greedy quantifier + ( not +? ) as we’re looking for the last word of current line, anyway !
As the search regex contains three expressions with the + quantifier, this means that each group is not empty. And, in case of the minimal sentence Paul John., the group 2 is just the space char between the two firstnames !
Best Regards,
guy038