What is the best method for using Regular Expressions within Objective-C?
There seems to be some open source project that provide regex
NSPredicate *predicate;
predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES '.*@.*\..*'"];
BOOL result = [predicate evaluateWithObject:@"mail@domain.com"];
According to the Predicate guide:
Matches
The left hand expression equals the right hand expression using a regex-style comparison according to ICU v3 (for more details see the ICU User Guide for Regular Expressions).
There's even an example written by Apple that can be found in the guide.
Instead of SELF
you could also use a key path. (And possibly some other literals too.)