View Single Post
Old 12-27-2020, 03:41 PM   #10
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,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Again, I am not sure what exactly you want to do. If you want to remove "Fiction.Cultures & Regions" and "Fiction.Social Issues" prefixes but leave their children then try this:
Code:
program:
	g = field('#genre');
	stripped_hierarchies = list_re_group(g, ',', '.',
			'^(Fanfiction|Documentation and Manuals|Fiction\.Cultures & Regions|Fiction\.Social Issues)($|\..*$)',
			'{$}', '');
	split_hierarchies = re(stripped_hierarchies, '\.', ',');
	cleaned = list_union('', split_hierarchies, ',');
	sorted = list_sort(cleaned, 0, ',')
All of the prefixes you want to remove must be in the first argument separated by | characters
chaley is offline   Reply With Quote