Regex for comma separated characters
regex
Solution
^(?!.*?([A-D]).*?\1)[A-D](?:,[A-D])*$
Try this.See demo.
https://regex101.com/r/uC8uO6/8
Problem
I'm looking for a regex to validate a set of non repeating characters separated by commas. Given the set of characters like ABCD Match any comma separated permutation (no repeating characters) Some matches would be: A C C,B B,D D,B,A,C Some no matches would be: A,A ABC D,B,A,B This would work but doesn't allow the commas: ``` \b(?!(?:.\B)*(.)(?:\B.)*\1)[ABCD]+\b ```