I have 4 complex regex patterns, A, B, C and D. I need to locate all the patters that are of the format of A(B AND C AND D) where the order of B,C,D does not matter and C and D are optional. Is there a way to do such a thing in regex without writing all the possible permutations of B,C,D with or (|) between them?
I’m programming this in Java, and prefer to performance-friendly. Thanks!
Edit: Changing 3 complex patters to 4 complex regex patterns.
No. You have to write all the permutations. It is a limitation of the regular languages. Once you do it however, it will be as performance friendly as any other regular expression.