View Single Post
Old 03-25-2023, 04:02 PM   #533
Lys
Groupie
Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.Lys ought to be getting tired of karma fortunes by now.
 
Posts: 170
Karma: 727278
Join Date: Dec 2022
Location: Not in an English speaking country
Device: (Too many) Kobo(s)
I feel there's an easy solution to this, but I can't find it on my own, so I need a bit of help.

I have a column (genre) that I use as a hierarchical tag.
Some examples of data I have in this column are:

Fiction.Classics.English Literature
Fiction.Classics.French Literature
Fiction.Historical Novel.Country: India
Fiction.Fantasy

Then I have another column (genre_list) that separates genres using:

Quote:
list_remove_duplicates(re($#genre, '\.', ','), ',')
And so far so good.


Now, I would like to have another column that excludes some items from genre_list.
The items I would like to remove are the ones matching the pattern: "xxxx Literature" and "Country: xxxx"

I know I can use list_difference to exclude values, but the list with the excluded values is compared term by term.
Is there a way to do so without having to list beforehand all occurrences of Country: xxxx, Xxxx Literature, but using the pattern?

Lys is offline   Reply With Quote