I have strings containing sequences like these:
^^fruit/citrus^fruit/citrus/orange^meat^vegetables/carrot^^
^^fruit/citrus^vegetables^vegetables/carrot^^
^^fruit/citrus/orange^vegetables/carrot^^
^^fruit/citrus/lemon^vegetables/potatoe^^
Steps in a sequence are separated with ^ character.
I would like to be able to use a multi-character wildcard to search those strings, but the wildcard should work only within a scope of a step. For example this pseudo-query:
^^[fruit/*]^vegetables/*^^
Should match all seqences starting with any step starting with "fruit/" followed by a step starting with "vegetables/". So these should be matched:
^^fruit/citrus/orange^vegetables/carrot^^
^^fruit/citrus/orange^vegetables/potatoe^^
but not these:
^^fruit/citrus^fruit/citrus/orange^meat^vegetables/carrot^^
^^fruit/citrus^vegetables^vegetables/carrot^^
Is there a way to this in MySQL (5.6 or 8.0) REGEX? Where do I get started?