title: Extract parts from regular expression with NSRegularExpression
body: <p>I want extract parts of a string with NSRegularExpression.</p>
  
  <p>For example, I have this string:</p>
  
  <pre><code>@"1   UIKit                               0x00540c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163";
  </code></pre>
  
  <p>And I want extract "UIKit", "0x00540c89", "UIApplication", "_callInitializationDelegatesForURL:payload:suspended:" and "1163".</p>
  
  <p>I have maked the regular expression:</p>
  
  <pre><code>@"^[0-9]+\\s+[a-zA-Z]+\\s+0x[0-9a-zA-Z]+\\s+\\-\\s*\\[[a-zA-Z]+\\s+[_:a-zA-Z]+\\]\\s+\\+\\s+[0-9]+"
  </code></pre>
  
  <p>But I dont know how I have to do this. It is possible.</p>
  
  <pre><code>    NSString *origen = @"1   UIKit                               0x00540c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163";
      // Setup an NSError object to catch any failures
      NSError *error = NULL;
      NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"^[0-9]+\\s+[a-zA-Z]+\\s+0x[0-9a-zA-Z]+\\s+\\-\\s*\\[[a-zA-Z]+\\s+[_:a-zA-Z]+\\]\\s+\\+\\s+[0-9]+" 
                                                                             options:NSRegularExpressionCaseInsensitive 
                                                                               error:&amp;error];
      // create an NSRange object using our regex object for the first match in the string
      NSRange rangeOfFirstMatch = [regex rangeOfFirstMatchInString:origen options:0 range:NSMakeRange(0, [origen length])];
      // check that our NSRange object is not equal to range of NSNotFound
      if (!NSEqualRanges(rangeOfFirstMatch, NSMakeRange(NSNotFound, 0))) {
          // Since we know that we found a match, get the substring from the parent string by using our NSRange object
          NSString *substringForFirstMatch = [origen substringWithRange:rangeOfFirstMatch];
          NSLog(@"Extracted: %@",substringForFirstMatch);
      }
  </code></pre>