Created
October 8, 2010 20:20
-
-
Save aiwilliams/617462 to your computer and use it in GitHub Desktop.
Purist NS Regexp (Predicate)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *actual = @"actual string"; | |
NSString *regex = @"^actual string$"; | |
NSPredicate *regextest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex]; | |
BOOL isMatch = [regextest evaluateWithObject:actual]; | |
STAssertTrue(isMatch, @"Expected %@ to match %@", actual, regex); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment