Use case

Return "Valid" if the custom field value matches the regular expression and "Invalid" if it does not.

Expression

Create and configure a Smart field using this expression in General parsing mode:

%{matches(%{issue.cfnnnnn},"6|7|8|9") ? "Valid":"Invalid"}

The values entered as arguments in the matches() parser function can be replaced with different values or with a regular expressions to validate differently the value of the custom field.

Please, note that it is necessary to replace nnnnn with the ID of the custom field.

Used parser functions