Error validating email addresses in Core Data
Error validating email addresses in Core Data
- Subject: Error validating email addresses in Core Data
- From: Michael Crawford <email@hidden>
- Date: Fri, 15 Apr 2011 09:30:39 -0400
I'm trying to validate email addresses in Core Data but the regular expression I'm using doesn't seem to work even though it looks correct. I'm using the following expression:
^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$
Which produces the following error:
NSValidationErrorKey=email, NSLocalizedDescription=The operation couldn’t be completed. (Cocoa error 1680.), NSValidationErrorPredicate=SELF MATCHES "^[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$", NSValidationErrorValue=email@hidden
I'm pretty certain the expression is correct so I'm thinking there must be something I don't know about how to use it with Core Data. I'm inputing the expression in the MOM editor in Xcode 4, not coding to the APIs directly. In my code I'm calling -[NSManagedObject validateForInsert].
If you've run into problems using regular expressions with Core Data and then found a solution or if you see some obvious problem with what I have here, I'd love to here from you.
-Michael
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden