[Solved] Finding regular expression with at least one repetition of each letter
You could find all substrings of length 4+, and then down select from those to find only the shortest possible combinations that contain one of each letter: s=”AAGTCCTAG” def get_shortest(s): l, b = len(s), set(‘ATCG’) options = [s[i:j+1] for i in range(l) for j in range(i,l) if (j+1)-i > 3] return [i for i in … Read more