function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shree KShree K 

How to limit the size of the value in the fields?

how to write a validation rule to let the users enter exactly 8 characters not less than 8 not more than 8 (4 Alpha-4 numeric) in a text field,

Thanks in Advance

You can use below condition in Validation rule, and it will throw the exception if the length of value is more than 8 or less than 8 and also check the pattern should be alph numeric.

NOT( REGEX( FIELD_NAME, "[a-zA-Z0-9_+-]+")) 

Ashlekh Gera
James WooleyJames Wooley
If you want exactly 4 alpha follwed by 4 numeric, the following validation rule should work:

NOT( REGEX( FIELD_NAME, "[a-zA-Z]{4}[0-9]{4}"))

If you wanted only upppercase for the aplha you could use:

NOT( REGEX( FIELD_NAME, "[A-Z]{4}[0-9]{4}"))