in reply to Re: parsing a very large array with regexps
in thread parsing a very large array with regexps

From your description, let me make a simpler example and explain a possibility. Suppose I have a 4 "morpheme" word, ABCD where I am simply denoting each morpheme by a letter. Then I can search for all that you asked by creating a monster alternation of the form
/^(A|B|C|D|AB|BC|CD|ABC|BCD|ABCD)$/
where each of the complete possibilities is written in one alternation. A more efficient way is to factor out what is common, so that you could write:
/^(A(B(CD?)?)?|B(CD?)?|CD?|D)$/
Note that there are only four possible starting points, and if they don't occur, you don't have to look any further.

Similarly, in the example you gave, with 255 or more possible COMPLETE patterns to match, every one of them must start in only one of 9 possible ways, right? So you need to help the regexp engine by making the regexp more efficient, and that means factoring all the similar starting points into a single expression.

I am quite sure that this approach should work for your case.