stiefels.net Just another WordPress weblog

24Jan/0713

Regular Expressions for NSString

Last weekend I was looking for different options to validate NSString objects against some regular expressions.
While there are some 3rd party classes for doing regular expressions in Cocoa and wrappers for Perl/PCRE there is a way to do that without external software. The magic word is called [NSPredicate](http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSPredicate_Class/Reference/NSPredicate.html).
This approach may perhaps not be obvious because there is (at this time) no direct documentation or hint in the [ADC documentation](http://developer.apple.com).