Skip to content

Commit

Permalink
Use NSRegularExpression instead of NSPredicate
Browse files Browse the repository at this point in the history
  • Loading branch information
leonklingele committed Jan 9, 2015
1 parent a76c8bf commit 6d3cee7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CTCDefaults.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6d3cee7

Please sign in to comment.