I’m looking for a way to find the smallest possible regular-expression that accepts a sequence.
To make it interesting I don’t want any stars(Kleene stars) and preferably no wildcards?
For instance the sequence : ‘aaaaaaaa’ would be accepted by ‘a^8’ and a^8 would be the shortest possible expression to accept the sequence.
Does anyone body know how to generate such an expression?
The search space for what you are after will most likely grow exponentially as the string grows, since there is usually a large amount of regular patterns that can match a given string.
I think that in your case you could try using some search heuristic to try and approximate or even manage to find the optimal solution. I do not think that there is a straightforward solution for that (albeit that is just my opinion).