I have a regex that I'm trying use to validate against strings. Trying to catch anything that is not: Upper Case alpha, Number, -, /, does not contain spaces and must be atleast 4 characters long and not exceed 78.
I have validated the regex and know that it works, just can't figure out what's wrong.
So far this is what I have:
var turkey = new RegExp('^(\S[A-Z0-9-/]{4,78})$');
if (turkey.test(serialNumber)) {
alert('pass');
}
else {
alert('fail');
}
Pass:
AS4345-ADFSF/ASDF-445
D/-F4
/ER45-DFGH334/45-4FS
Fail:
aDF345#SD/fr
45-fg/422 fgs
2SD
g-5