Merge duplicate words

Try this one from the other thread: (I adapted it for "/" as separator)

$trim($regexp(%Genre%,'(?:(?<=/)|(?<=\A))\s*([^/]*)\s*/(?=.*?(?<=/)\s*\1(?=/|\Z))',,1))