Quote:
Originally Posted by chaley
TPM is Template Program Mode.
A template that produces what you want for the example you provided is
Code:
{author_sort:'re($, '([, ]+)(\w)\w*', '\1\2.')'}
I don't know it it will produce the right answer in all cases.
|
It truncates everything after the first word. Including the second author's first name (since it includes "& LN,[...]").
This should work, though:
Code:
program:
re(
field('author_sort'),
'(\w)\w+\b(?!,)',
'\1.'
)
At some point I thought I'd try list_re to fix your example.
But I discovered this:
Code:
program:
list_re(
field('author_sort'),
'&',
'(.*)',
'\1'
)
gave me "LN1&FN1&LN2&FN2" -- isn't it supposed to search for "(.*)" and replace with "\1" on each list element where "&" is the separator? I cannot imagine what I might be doing wrong.
But this looks completely crazy.