I’m looking for a quick way to validate these rules for a string, in an OnDataChange event
9 characters or less
no imbedded spaces (trailing spaces are ok if that helps with the validation eg if it’s easier to work with the string of a fixed length)
1st character must be A, B, C, D or X
2nd-8th characters may be alpha/numeric;
9th character (if populated) must be alpha, not numeric
It looks like a job for Regex, but I’m not sure how to do the last rule and the variable lengths. Grateful for some guidance, or alternative approaches.
Hoping someone can help with another regex validation.
It’s for dental work. Valid values:
11-18
21-28
31-38
41-48
51-55
61-65
71-75
81-85
i.e.
must be exactly 2 digits.
first digit must be 1-8
if first digit is 1-4 then second digit must be 1-8
if first digit is 5-8 then second digit must be 1-5