Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Custom validation script for 8-digit hex number

New Here ,
Sep 12, 2017 Sep 12, 2017

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.

TOPICS
PDF forms
1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
LEGEND ,
Sep 12, 2017 Sep 12, 2017

Try changing the regular expression to the following:

var regexp = /[^abcdefABCDEF0123456789]+/

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 12, 2017 Sep 12, 2017

Try changing the regular expression to the following:

var regexp = /[^abcdefABCDEF0123456789]+/

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 13, 2017 Sep 13, 2017

With that, all values are considered OK.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 13, 2017 Sep 13, 2017
LATEST

oops, actually that worked. Thanks.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines