I wrote a Java program which can generate a sequence of symbols, like \"abcdbcdefbcdbcdefg\". What I need is Regex optimizer, which can result \"a((bcd){2}ef)
I assume you are trying to find a small regex to encode a finite set of input strings. If so, you haven't chosen the best possible subject line.
I can't give you an existing program, but I can tell you how to approach writing one.
There is no canonical minimum regex form and determining the true minimum size regex is NP hard. Certainly your sets are finite, so this may be a simpler problem. I'll have to think about it.
But a good heuristic algorithm would be:
Note that step 3 does give you a unique minimum DFA. That would probably be the best way to encode your string sets.