View Single Post
Old 07-26-2020, 12:20 PM   #8
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,465
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by vargr View Post
After testing a few files with this, I have some more questions...

1) Is it possible to return the shortened form for both when there's more than one pair of names in the field separated by a comma?
This turns commas into slashes then computes the list of first names.
Code:
program: list_re(re(field('#text'), ',', '/'), '/', '^(..*?)\b.*$', '\1')
2) Can it account for " & " in place of "/", i.e., "John Doe & Jim Smith" to "John & Jim"? (This isn't as big a deal, but I do have some fields like that.)[/QUOTE]I assume that the spaces are around the names in the source and that you want them in the result. The second parameter to list_re is the separator. Change '/' to ' & '.
Code:
program: list_re(field('authors'), ' & ', '^(..*?)\b.*$', '\1')
chaley is offline   Reply With Quote