Regex to check non-repetition of a set of characters

前端 未结 8 942
无人共我
无人共我 2020-12-19 12:47

Suppose I have the set of characters [ABC]. I\'m looking for a regex that would match any permutation of the superset except the empty set, i.e.



        
8条回答
  •  不知归路
    2020-12-19 13:28

    Try this : (UPDATED)

    A[BC](?![ABC])|B[AC](?![ABC])|C[AB](?![ABC])|[ABC](?![ABC])|(ABC|ACB|BAC|BCA|CAB|CBA)(?![ABC])
    

    Demo :

    http://regexr.com?30pa6

提交回复
热议问题