custom format with 2 possible conditions
I am tring to set a text cell to only allow 2 posible formats , so only 3 munmbers like 123 or AA234 so eather 5 caracters starting with 2 letters or only 3 characters but it can be one or the other.
So I tried using regex and some if conditions, but I need help to make it work or find an easier solution.
I added the following code in the custom keystroke script with custom Format area.
any feedback on where to put it and if it is correct? or should I be using AA999 and 999 instread of the rejex native rules?
var myRegExp2 = \D{2}\d{3};
var myRegExp = \d{3};
var myTextInput = event.value;
event.rc = true;
if((myRegExp.test(myTextInput)) || (myRegExp2.test(myTextInput))){event.target.textColor = color.black;} else{ app.alert( "You need to type 9 characters or a ISQ 12 characters starting by2 letters ")}