I'm trying to develop some problems that my instructor gave me, and one of those problems is asking me to check if the input string complies with the following rules:
- That the string contains numbers from 2 to 9.
- That the string contains the letters TJQKA.
- If within the string there is any other letter outside the mentioned ones, then the String is invalid.
EX:
643TJAKQ = Ok
72MAJTQ = Not Okay
1246AKJQ = Not Okay
AKT432 = Ok
This obviously is a Regex problem, because if I try to filter by lists, arrays or something else, It's going to take too much time just validating this (And I writting the code). I tried with this reg exp (/[2-9]|(T|J|Q|K|A)/g
) but is garbage.