I have a string of four bits which represent true/false values. There are only seven valid options:
1010
1110
0000
1101
1001
1000
0101
There are three options which could potentially be selected which are not valid and that I want to check for before I proceed with some other code. These are:
0110
0100
0010
I want to do this with as little code as possible thus having one regex to test all three conditions. My question is if this is a correct regex to accomplish this test. It seems to work, but I am not a regex expert, and have to be sure in this case.
if (!/0(10|01|11)0/.test(precode)) {
//do some code
}