How to check if string matches a regular expression in objective-c?
I’ve used NSPredicate for that purpose: NSString *someRegexp = …; NSPredicate *myTest = [NSPredicate predicateWithFormat:@”SELF MATCHES %@”, someRegexp]; if ([myTest evaluateWithObject: testString]){ //Matches }