mardi 22 août 2017

All permutations of a Regular expression

I want to construct a regular expression which will match all the strings which have exactly one occurrence of each of character of M, N, P, Q and possibly infinite occurrence of A, C, G, T (a few examples are MNPQA, MNAAPQ, MNPQ, MAPGNQC, etc.). One way I found is MNPQ[ACGT]* and get all the permutations of the result. The question is can we construct a only one regexp which will generate all the strings I want, or if that's not possible can I check also for occurrence of all the permuted regexps (first option) in a string using C++11 regexp API ?

Aucun commentaire:

Enregistrer un commentaire