I am doing a parser for nand2tetris project. I want to check if the destination field is either M|D|MD|A|AM|AD|AMD
and their different ways of combinations like MA
not only AM
.
^(M|D|MD|A|AM|AD|AMD)\s*=$
This regex correctly matches AM=
, but not MA=
.
I don't want to list out all the possible combinations of those tokens, is there a way to do it simply?
^(M|D|DM|A|AM|AD|ADM)\s*=7$
and also the input token in order, that will match – Rollmop^([ADM])(?:(?!\1)([ADM])(?:(?!\1|\2)[ADM])?)?\s*=$
regex101.com/r/SNhJpf/2 – Consternation(.)(?!\1)(.)(?!\1|\2).
) but I can't find it again. – Consternation^(?!(?:.\B)*(.)(?:\B.)*\1)[AMD]+\b=$
then – Doorway