Grouping vector of strings by left - right context

Hi,

I have seen a few example approaches (covert to DataFrame, write your own), but can’t quite get my scenario to work.

I have a vector of strings with a character to split on that maps to the vector of “columns” (separated like this to reduce redundancy) and what I want to achieve is a grouped output about each of the “columns”. E.G:

struct ColumnSetQuery <: IQueryModel
    columnSet :: Vector{String}
    argSeperator :: String
    wildCard :: String
    querySet :: Vector{String}
end
StructTypes.StructType(::Type{ColumnSetQuery}) = StructTypes.Struct()

argSeperator = "-"
wildCard = "?"
columnSet = ["name","surname","region"]
querySet = ["AD-FR-FR","AD-FR-AN","AD-FG-?","AP-FG-?", "AP-DR-PQ","AP-FR-FR"]


What I want to achieve is something like:

groupBy(querySet) = [["AD","FR",{"FR","AN"}],["AD","FG","?"],["AP",{"FG","DR"},"PQ"], ["AP","FR","FR"]]

note that I use {} to describe the problem better (I hope) rather than and that, by virtue of “AD-FR-FR” already being grouped, it doesn’t then end up grouped into “AP-FR-FR” e.g. [{“AD”,“AP”},“FR”,“FR”] (which is purely due to the order encountered and to mitigate duplication).

I tried foldl, groupby from SplitApplyCombined.jl but haven’t got it working.

Any help would be appreciated.

Regards,