I am trying to validate a text field for an email address. I found this Objective C code that will validate a NSString to make sure it is a proper email address.
- (BOOL)validateEmail:(NSString *)email {
NSString *emailRegex = @“[A-Z0-9a-z._%±]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}”;
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@“SELF MATCHES %@”, emailRegex];
return [emailTest evaluateWithObject:email];
}
How would I either:
a. Convert this to Applescript.
b. Leave it as Objective C and call it from my Applescript code.
Assume the string I will be handing off is a simple Applescript string.
Thanks.