Search through NSString using Regular Expression

How might I go about searching/enumerating through an NSString using a regular expression?

A regular expression such as: /(NS|UI)+(\w+)/g.


You need to use NSRegularExpression class.

Example inspired in the documentation:

NSString *yourString = @"";
NSError *error = NULL;
NSRegularExpression *regex = [NSRegularExpression         
[regex enumerateMatchesInString:yourString options:0 range:NSMakeRange(0, [yourString length]) usingBlock:^(NSTextCheckingResult *match, NSMatchingFlags flags, BOOL *stop){
    // your code to handle matches here

Need Your Help

Auto post in 2 domains

xml wordpress plugins cron feeds

I need a help how to proceed my project, I have 2 domains and, both are blogging websites

IIS smooth streaming does not play a video on MVC 4 with Razor iis smooth-streaming smooth-streaming-player

I am trying to get a basic demo working but can't succeed, I've spent hours and hours on it..

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.