View Single Post
Old 02-21-2023, 09:30 AM   #13
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 583
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by Phssthpok View Post
But you're right, it doesn't seem to work for single-name authors. No comma, no match in the RE. Hmm...
Cheap-and-nasty fix: make the comma-plus-name optional:
Quote:
{author_sort:'re(list_re($, '&', '^([^,]*)(,(.*))?$', '\3 \1'),'&',', ')'}
The only issue is that it's now taking everything up to the first comma as the last name, whereas before it was everything up to the last comma -- but there's only ever one (by design, when I tweak the author_sort values for "special" names), so it doesn't matter.

Leading and trailing spaces seem to be trimmed, so no further effort is needed.

Oh, and you're right about the trailing-space-only thing -- I must have fumbled it before.
Phssthpok is offline   Reply With Quote