View Single Post
Old 06-25-2014, 09:39 AM   #14
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 chaley View Post
Now I need to add another function like list_re that uses re_group instead of re. Something like
Code:
list_re_group(src_list, separator, search_re, group_1, group_2, ...)
that would apply the re_group to each item in the list.
I submitted this function as well. The prototype is different from what I suggested earlier:
Code:
list_re_group(src_list, separator, include_re, search_re, group_1, group_2, ...)
The function first builds a result list by applying 'include_re' against each list element, then applies re_group(search_re, g1, ...) to each resulting element.

This thread provides an example of this function's use, to uppercase the last name of each author for a book:
Code:
program: list_re_group(field('authors'), ' & ', '.', '([^,]*), (.*)', '{$:uppercase()}, ', '{$}')
or
Code:
{authors:'list_re_group($, ' & ', '.', '([^,]*), (.*)', '[[$:uppercase()]], ', '[[$]]')'}
chaley is offline   Reply With Quote