For a given set of characters, what is the regex to match all strings that are exactly formed by one or more caracters from the given set ?
Example1: for (a, b, c, d):
- bdca (match)
- adb (match)
- abcg (fail: 'g' not in the set)
- aab (fail: only one 'a' is in the set)
Example2: for (a, a, c, d):
- adca (match)
- aaad (fail: the third a is not in the set)
- Those shoud work too: a, aa, dc, aac, ada, acd, and daca. But not this: aaca, acada, accd, abcdef
In other terms, each used character will be consumed. So we can use all given characters or only some of them, but without extra characters or duplicate use more than the given number of each character.
I tried several regex but I didn't find any good solution.
Please any help?