and the task is to find maximum $pattern to fit these constraints?
Um. I cannot see any errors in that. So yes.
If yes, some simple mathematics should already considerably minimize the set of possible combinations you need to investigate with regexes.
Hm. A realistic, but relatively small, example from my test harness:
L=64000, N = 10,000, K=28,740.
But those could equally well be: L=16,000, N = 40,001, K=12,740; or (thousands*) of other permutations.
I don't think it helps.
(*I'm being very, very conservative; my best guess is 100s, of millions.)
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.