Given set of n characters, what regex do we need to match a sequence of 0-x permutations of these characters?
We want permutations. Given set of 3 characters A,B,C we want to match ABC, ACB, BAC, BCA, CAB, CBA.
However, we want to match a sequence of these permutations. Sequence may contain 0 or more permutations, meaning that we want to match empty string, ABC, ABCBCA, BACCAB, BCAABCCBAABC, etc.
I was able to find solutions to match a permutation, but was unable to modify it to match a sequence of permutations.
I understand that sometimes the used regex engine might make difference. I would like to use this regex in C#'s Microsoft.VisualStudio.TestTools.UnitTesting.StringAssert.Matches
method, should that make a difference. We simply want to check whether output string of tested method matches this regex, i.e. is a sequence of permutations of given set of characters.