From 6d3cee7dfa39f898fb60b42d512d2d82c185486e Mon Sep 17 00:00:00 2001 From: Leon Klingele Date: Fri, 9 Jan 2015 13:02:46 +0100 Subject: [PATCH] Use NSRegularExpression instead of NSPredicate --- CTCDefaults.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CTCDefaults.m b/CTCDefaults.m index d724d80..d2fd2c9 100644 --- a/CTCDefaults.m +++ b/CTCDefaults.m @@ -91,8 +91,9 @@ + (void)refreshLoginItemStatus { + (BOOL)isFeedURLValid { NSString *feedURL = CTCDefaults.feedURL; - NSPredicate *feedURLTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", kCTCDefaultsServiceFeedURLRegex]; - if (![feedURLTest evaluateWithObject:feedURL]) { + NSRegularExpression *feedURLRegex = [NSRegularExpression regularExpressionWithPattern:kCTCDefaultsServiceFeedURLRegex options:0 error:nil]; + NSTextCheckingResult *feedURLMatches = [feedURLRegex firstMatchInString:feedURL options:0 range:NSMakeRange(0, [feedURL length])]; + if (!feedURLMatches) { // The URL should match the prefix regex! NSLog(@"Feed URL (%@) does not match Regex (%@)", feedURL, kCTCDefaultsServiceFeedURLRegex); return NO;