Your first work [^a-z][^a-z]* could be re-written as [^a-z]+
The * means any number of times
The + means at least once.
You pointed out that a dash can be the last character of in set
But then you placed a <39> after it, thereby breaking the rule.
Also remember you can use Match:Regular+Match:NoCase vs. getting into (slightly) more complex RegEx
OK, I looked at your attached program (even though I find it hard to work with .apps)
Why do you reverse the return values from ValidateData ?
I Found this easier to understand.
IF MATCH( CLIP(LOC:Firstname),CLIP(LOC:Pattern), Match:Regular )
?Box1{prop:fill} = COLOR:GREEN
ELSE ?Box1{prop:fill} = COLOR:RED
END
I think the problem you have is that you’re thinking that the match must match the whole string
For instance, say you had this MATCH( CurrString, ‘[a-z]’, MATCH:Regular)
At first glance, you’d think this would only match a string that was one character long and was a lower case letter.
Well, no…
It will match any string, that has a lower case letter anywhere inside of it.
So… I think what you really having in mind is a pattern like this:
^[a-z][a-z'-]*$
Let me break that down…
The first and last symbols: ^ means start of string, and $ means end of string
So now only those things that match the pattern between the ^$ will now return as a match
Then we have [a-z] – any letter
Then we have [a-z’-] – any letter, a single quote or a dash
Note the the <39> is a notation for a CHR(39) but that only applies to string literals, not entered values like you had in your program.
So… the final answer
MATCH( CLIP(IsAName), '^[a-z][a-z'-]*$', MATCH:Regular + Match:NoCase)
And don’t forget to fix the reversed return values in your ValidateData function