I have a list of characters, for example. {o, b, c, c, d, o, f}.
If a string contains characters that are not on this list, I do not want this to be a match. If a string contains more occurrences of a character than there are occurrences of that character in this list, I do not want this to be a match.
Characters in a string can occur in any order, and all characters should not appear. The above example "foo"should be a match, but not "fooo".
For example, I narrowed down the above example to (o{0,2}b?c{0,2}d?f?), but that doesn’t quite work, since order matters in this regular expression. I get matching for "oof", but not for "foo".
source
share