cancel
Showing results for 
Search instead for 
Did you mean: 

First Name should have at least 1 alphabet

First Name should have at least 1 alphabet

Can you help me to find the right RegEx which finds the records that have at least one alphabet in it?

For example:
"E?" is valid
"??" is not valid.
"E" is valid

Labels (1)
2 Replies

REGEXP(STR(@First Namel@), ".*[a-zA-Z].*","") 

You can describe alphabetic characters using the inclusive regex matcher:
[a-zA-Z]
Note that the Computed Column function REGEXP only replaces matching strings, simply duplicating the input if it does not match. Therefore, to make your step bulletproof you need to produce a result that is guaranteed not to be identical to the input. For example, create a Computed Column that creates a column named "Valid First Name":
IF(REGEXP(@First Name@),".*[a-zA-Z].*",CONCATENATE("_",@First Name@))=@First Name@,"N","Y")
This produces a value where the input is prefixed with an underscore _, marking that value so you know it's different from the input. If it marks, then you know there was an alphabetic character; otherwise, there were no alphabetic characters.