I want to build a regex that will match the following strings:
A string with all or some of the 4 characters “A”,”B”,”C” and “D”
the “ABCD” can occur at any position at most once.
For example, the following are expected to match:
A,AB,CABD,DC,BDCA,ABC,...
The following should not match:
ABA,BB,ABCC,DDAA,AACD...
Do you have any suggestion for me?
This one should do it (Python syntax):
Here is a JavaScript version: