So I've been fiddling with it some more, and figured out I can use the same principle as this
Code:
program:
a = list_intersection($ao3tags, 'tram, train, bus, ferry', ',');
list_union($#genre, a, ',')
but instead use 're' in the place of list-union
Code:
program:
a = list_intersection($#show, 'Ferry, Bus', ',');
re($#show, a , 'Vehicles, Public Transport')
The issue lies within the following, if a story has the following
tags: Bus, Car, Ferry, Ferry Terminal,
the result will be:
tags: Vehicles, Public Transport, Vehicles,
Public Transport Terminal, Red, Car
The tag 'Ferry Terminal' will result in 'Public Transport Terminal'.
I figured the reason is because it is a match but not an exact match.
I've tried several options trying to get an exact match using ^ and $ like with regex but I keep getting errors
Can anyone point me in the right direction, because the Calibre Manual

is not getting me anywhere on this one.