So far I have this regex ^(?!.*?(a|c|e|g|i).*?\1)[acegi]+$
which match any word as combination of the characters "acegi", and these characters can occur only once.
Now I'm trying to match any word which will consist of given characters and these characters can repeat as many times as given.
Example for set of given characters "acegii"
Valid matches: "acegii" "ace" "a" "i" "ai" "gii" "ici" "iic" "aicige" etc.
Invalid matches: "acegiii" "iacegii" "iii" "aa" "cc" etc.
Thanks for any help!
Note: the characters set in the regex should be easily replaceable if possible.
Prefered regexs: posix, ruby