Copy link to clipboard
Copied
I can't seem to figure out how to make a custom validation script to validate an 8 digit number in hexadecimal format. I've set the Arbitrary Mask to 'OOOOOOOO' to make sure it's 8 digits long, but the characters must actually be 0-9 or a-f (not case sensitive).
This is what I have but it always says it's invalid:
var regexp = /[^abcdefABCDEF0123456789]*/
if (regexp.test(event.value) == true)
{
app.alert("Not a valid serial number!");
event.target.textColor = color.red;
}
else
{
event.target.textColor = color.black;
}
Please help! Thanks.
Copy link to clipboard
Copied
Try changing the regular expression to the following:
var regexp = /[^abcdefABCDEF0123456789]+/
Copy link to clipboard
Copied
Try changing the regular expression to the following:
var regexp = /[^abcdefABCDEF0123456789]+/
Copy link to clipboard
Copied
With that, all values are considered OK.
Copy link to clipboard
Copied
oops, actually that worked. Thanks.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more