Генерация кратчайшего регулярного выражения из исходного списка строк

У меня есть группа SKU (единицы хранения запасов), которые представляют собой ряд строк, которые я хотел бы создать для одного регулярного выражения.

Итак, например, если у меня есть SKU:

var skus = new[] { "BATPAG003", "BATTWLP03", "BATTWLP04", "BATTWSP04", "SPIFATB01" };

... Я хотел бы автоматически генерировать Regex, чтобы распознать любой из SKU.

Я знаю, что я мог бы просто сделать "BATPAG003|BATTWLP03|BATTWLP04|BATTWSP04|SPIFATB01", но список SKU может быть довольно длинным, и я хотел бы сжать полученное Regex, чтобы выглядеть как "BAT(PAG003|TW(LP0(3|4)|SP04))|SPIFATB01"

Итак, это комбинаторика. Я хочу сгенерировать все возможное Regex, чтобы соответствовать любой из моих входных строк, причем представление, что кратчайший, вероятно, лучший.

Я мог бы, например, произвести любое из них:

BATPAG003|BATTWLP03|BATTWLP04|BATTWSP04|SPIFATB01
BAT(PAG003|TW(LP0(3|4)|SP04))|SPIFATB01
BAT(PAG003|TW(LP(03|04)|SP04))|SPIFATB01
B(ATPAG003|ATTW(LP0(3|4)|ATSP04))|SPIFATB01

Любой из них будет работать, но самый короткий - это тот, который я бы выбрал.

Для начала я попытался реализовать эту функцию:

Func<IEnumerable<string>, IEnumerable<string>> regexify = null;
regexify = xs =>
    from n in Enumerable.Range(1, 10)
    let g = xs.ToArray().Where(s => !String.IsNullOrWhiteSpace(s)).GroupBy(x => new String(x.Take(n).ToArray()), x => new String(x.Skip(n).ToArray()))
    let parts  = g.SelectMany(x => x.Count() > 1 ? regexify(x).Select(y => x.Key + "(" + String.Join("|", y) + ")") : new [] { x.Key + String.Join("", x) })
    let regex = String.Join("|", parts)
    orderby regex.Length
    select regex;

Это берет мой источник skus и приводит к списку возможных Regex, но он не работает. Это текущий вывод:

BATPAG003|BATTWLP03|BATTWLP04|BATTWSP04|SPIFATB01 
BATPAG003|BATTWLP03|BATTWLP04|BATTWSP04|SPIFATB01 
BATPAG003|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWSP04|SPIFATB01 
BATPAG003|BATTWLP(03|04)|BATTWLP(03|04)|BATTWLP(03|04)|BATTWLP(03|04)|BATTWLP(03|04)|BATTWLP(03|04)|BATTWLP(03|04)|BATTWLP(03|04)|BATTWLP(03|04)|BATTWLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|BATTWSP04|SPIFATB01 
BATPAG003|BATTWL(P03|P04)|BATTWL(P03|P04)|BATTWL(P03|P04)|BATTWL(P03|P04)|BATTWL(P03|P04)|BATTWL(P03|P04)|BATTWL(P03|P04)|BATTWL(P03|P04)|BATTWL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|BATTWL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|BATTWSP04|SPIFATB01 
BATPAG003|BATTW(LP03|LP04|SP04)|BATTW(LP03|LP04|SP04)|BATTW(LP03|LP04|SP04)|BATTW(LP03|LP04|SP04)|BATTW(LP03|LP04|SP04)|BATTW(LP03|LP04|SP04)|BATTW(LP03|LP04|SP04)|BATTW(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|BATTW(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|BATTW(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04)|SPIFATB01 
BATPAG003|BATT(WLP03|WLP04|WSP04)|BATT(WLP03|WLP04|WSP04)|BATT(WLP03|WLP04|WSP04)|BATT(WLP03|WLP04|WSP04)|BATT(WLP03|WLP04|WSP04)|BATT(WLP03|WLP04|WSP04)|BATT(WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WSP04)|BATT(WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|WSP04)|BATT(WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|WL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|WSP04)|BATT(W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|W(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|W(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))|SPIFATB01 
BAT(PAG003|TWLP03|TWLP04|TWSP04)|BAT(PAG003|TWLP03|TWLP04|TWSP04)|BAT(PAG003|TWLP03|TWLP04|TWSP04)|BAT(PAG003|TWLP03|TWLP04|TWSP04)|BAT(PAG003|TWLP03|TWLP04|TWSP04)|BAT(PAG003|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWSP04)|BAT(PAG003|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|TWSP04)|BAT(PAG003|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|TWL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|TWSP04)|BAT(PAG003|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|TW(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|TW(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))|BAT(PAG003|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WSP04)|T(WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|WSP04)|T(WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|WL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|WSP04)|T(W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|W(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|W(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04)))|SPIFATB01 
BA(TPAG003|TTWLP03|TTWLP04|TTWSP04)|BA(TPAG003|TTWLP03|TTWLP04|TTWSP04)|BA(TPAG003|TTWLP03|TTWLP04|TTWSP04)|BA(TPAG003|TTWLP03|TTWLP04|TTWSP04)|BA(TPAG003|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWSP04)|BA(TPAG003|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|TTWSP04)|BA(TPAG003|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|TTWL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|TTWSP04)|BA(TPAG003|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|TTW(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|TTW(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))|BA(TPAG003|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WSP04)|TT(WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|WSP04)|TT(WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|WL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|WSP04)|TT(W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|W(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|W(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04)))|BA(T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWSP04)|T(PAG003|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|TWSP04)|T(PAG003|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|TWL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|TWSP04)|T(PAG003|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|TW(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|TW(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))|T(PAG003|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WSP04)|T(WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|WSP04)|T(WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|WL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|WSP04)|T(W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|W(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|W(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))))|SPIFATB01 
B(ATPAG003|ATTWLP03|ATTWLP04|ATTWSP04)|B(ATPAG003|ATTWLP03|ATTWLP04|ATTWSP04)|B(ATPAG003|ATTWLP03|ATTWLP04|ATTWSP04)|B(ATPAG003|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWSP04)|B(ATPAG003|ATTWLP(03|04)|ATTWLP(03|04)|ATTWLP(03|04)|ATTWLP(03|04)|ATTWLP(03|04)|ATTWLP(03|04)|ATTWLP(03|04)|ATTWLP(03|04)|ATTWLP(03|04)|ATTWLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|ATTWSP04)|B(ATPAG003|ATTWL(P03|P04)|ATTWL(P03|P04)|ATTWL(P03|P04)|ATTWL(P03|P04)|ATTWL(P03|P04)|ATTWL(P03|P04)|ATTWL(P03|P04)|ATTWL(P03|P04)|ATTWL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|ATTWL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|ATTWSP04)|B(ATPAG003|ATTW(LP03|LP04|SP04)|ATTW(LP03|LP04|SP04)|ATTW(LP03|LP04|SP04)|ATTW(LP03|LP04|SP04)|ATTW(LP03|LP04|SP04)|ATTW(LP03|LP04|SP04)|ATTW(LP03|LP04|SP04)|ATTW(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|ATTW(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|ATTW(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))|B(ATPAG003|ATT(WLP03|WLP04|WSP04)|ATT(WLP03|WLP04|WSP04)|ATT(WLP03|WLP04|WSP04)|ATT(WLP03|WLP04|WSP04)|ATT(WLP03|WLP04|WSP04)|ATT(WLP03|WLP04|WSP04)|ATT(WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WSP04)|ATT(WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|WSP04)|ATT(WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|WL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|WSP04)|ATT(W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|W(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|W(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04)))|B(AT(PAG003|TWLP03|TWLP04|TWSP04)|AT(PAG003|TWLP03|TWLP04|TWSP04)|AT(PAG003|TWLP03|TWLP04|TWSP04)|AT(PAG003|TWLP03|TWLP04|TWSP04)|AT(PAG003|TWLP03|TWLP04|TWSP04)|AT(PAG003|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWSP04)|AT(PAG003|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|TWSP04)|AT(PAG003|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|TWL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|TWSP04)|AT(PAG003|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|TW(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|TW(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))|AT(PAG003|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WSP04)|T(WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|WSP04)|T(WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|WL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|WSP04)|T(W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|W(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|W(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))))|B(A(TPAG003|TTWLP03|TTWLP04|TTWSP04)|A(TPAG003|TTWLP03|TTWLP04|TTWSP04)|A(TPAG003|TTWLP03|TTWLP04|TTWSP04)|A(TPAG003|TTWLP03|TTWLP04|TTWSP04)|A(TPAG003|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWSP04)|A(TPAG003|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|TTWSP04)|A(TPAG003|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|TTWL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|TTWSP04)|A(TPAG003|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|TTW(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|TTW(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))|A(TPAG003|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WSP04)|TT(WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|WSP04)|TT(WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|WL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|WSP04)|TT(W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|W(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|W(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04)))|A(T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWSP04)|T(PAG003|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|TWSP04)|T(PAG003|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|TWL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|TWSP04)|T(PAG003|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|TW(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|TW(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))|T(PAG003|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WSP04)|T(WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|WSP04)|T(WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|WL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|WSP04)|T(W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|W(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|W(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04)))))|SPIFATB01 

Он чувствует себя очень близко, и я думаю, что я немного делаю что-то неправильно.

Ответ 1

Это работает, если каждый идентификатор SKU имеет одинаковую длину.

// ...
string regexStr = Calculate(skus);
// ...

public static string Calculate(IEnumerable<string> rest) {
    if (rest.First().Length > 0) {
        string[] groups = rest.GroupBy(r => r[0])
            .Select(g => g.Key + Calculate(g.Select(e => e.Substring(1))))
            .ToArray();
        return groups.Length > 1 ? "(" + string.Join("|", groups) + ")" : groups[0];
    } else {
        return string.Empty;
    }
}

Ответ 2

Это то, что я наконец разработал:

var skus = new[] { "BATPAG003", "BATTWLP03", "BATTWLP04", "BATTWSP04", "SPIFATB01" };

Func<IEnumerable<IGrouping<string, string>>, IEnumerable<string>> regexify = null;

Func<IEnumerable<string>, IEnumerable<string>> generate =
    xs =>
        from n in Enumerable.Range(2, 20)
        let g = xs.GroupBy(x => new String(x.Take(n).ToArray()), x => new String(x.Skip(n).ToArray()))
        where g.Count() != xs.Count()
        from r in regexify(g)
        select r;

regexify = gxs =>
{
    if (!gxs.Any())
    {
        return new [] { "" };
    }
    else
    {
        var rs = regexify(gxs.Skip(1)).ToArray();
        return
            from f in gxs.Take(1)
            from z in new [] { String.Join("|", f) }.Concat(f.Count() > 1 ? generate(f) : Enumerable.Empty<string>())
            from r in rs
            select f.Key + (f.Count() == 1 ? z : $"({z})") + (r != "" ? "|" + r : "");
    }
};

Затем, используя этот запрос:

generate(skus).OrderBy(x => x).OrderBy(x => x.Length);

... Я получил этот результат:

BAT(PAG003|TW(LP0(3|4)|SP04))|SPIFATB01 
BAT(PAG003|TWLP0(3|4)|TWSP04)|SPIFATB01 
BA(TPAG003|TTW(LP0(3|4)|SP04))|SPIFATB01 
BAT(PAG003|TW(LP(03|04)|SP04))|SPIFATB01 
BAT(PAG003|TW(LP03|LP04|SP04))|SPIFATB01 
BAT(PAG003|TWLP(03|04)|TWSP04)|SPIFATB01 
BATPAG003|BATTW(LP0(3|4)|SP04)|SPIFATB01 
BA(TPAG003|TT(WLP0(3|4)|WSP04))|SPIFATB01 
BA(TPAG003|TTW(LP(03|04)|SP04))|SPIFATB01 
BA(TPAG003|TTW(LP03|LP04|SP04))|SPIFATB01 
BA(TPAG003|TTWLP0(3|4)|TTWSP04)|SPIFATB01 
BAT(PAG003|TWL(P0(3|4))|TWSP04)|SPIFATB01 
BAT(PAG003|TWL(P03|P04)|TWSP04)|SPIFATB01 
BATPAG003|BATT(WLP0(3|4)|WSP04)|SPIFATB01 
BATPAG003|BATTW(LP(03|04)|SP04)|SPIFATB01 
BATPAG003|BATTW(LP03|LP04|SP04)|SPIFATB01 
BA(TPAG003|TT(WLP(03|04)|WSP04))|SPIFATB01 
BA(TPAG003|TTWLP(03|04)|TTWSP04)|SPIFATB01 
BAT(PAG003|TWLP03|TWLP04|TWSP04)|SPIFATB01 
BATPAG003|BATT(WLP(03|04)|WSP04)|SPIFATB01 
BA(TPAG003|TT(WL(P0(3|4))|WSP04))|SPIFATB01 
BA(TPAG003|TT(WL(P03|P04)|WSP04))|SPIFATB01 
BA(TPAG003|TT(WLP03|WLP04|WSP04))|SPIFATB01 
BA(TPAG003|TTWL(P0(3|4))|TTWSP04)|SPIFATB01 
BA(TPAG003|TTWL(P03|P04)|TTWSP04)|SPIFATB01 
BATPAG003|BATT(WL(P0(3|4))|WSP04)|SPIFATB01 
BATPAG003|BATT(WL(P03|P04)|WSP04)|SPIFATB01 
BATPAG003|BATT(WLP03|WLP04|WSP04)|SPIFATB01 
BATPAG003|BATTWLP0(3|4)|BATTWSP04|SPIFATB01 
BATPAG003|BATTWLP(03|04)|BATTWSP04|SPIFATB01 
BA(TPAG003|TTWLP03|TTWLP04|TTWSP04)|SPIFATB01 
BATPAG003|BATTWL(P0(3|4))|BATTWSP04|SPIFATB01 
BATPAG003|BATTWL(P03|P04)|BATTWSP04|SPIFATB01 

Единственной проблемой с моим подходом было время вычисления. Некоторые из моих исходных списков содержат около 100 единиц кода. Некоторые из прогонов занимали больше времени, чем я хотел дождаться и должны были разбить его на более мелкие куски, а затем вручную объединить.

Ответ 3

Возьмите весь список всех ваших скинов и создайте однократное трехмерное регулярное выражение.
Когда вы добавляете или удаляете sku, регенерируйте регулярное выражение. Возможно, ваша база данных
генерируется еженедельно.

Эта утилита делает регулярное выражение в 10 000 строк менее чем за полсекунды и размер не важен, это может быть 300 000 строк.

Например, здесь находится регулярное выражение 175 000 слов словарь.

введите описание изображения здесь