title: NSRegularExpression: How to extract matched group from NSString?
body: <p>My code looks like  </p>
  
  <pre><code>    NSString *pattern = @"\\w+(\\w)";
      NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern
                                   options:NSRegularExpressionCaseInsensitive error:nil];
      NSString *testValue = @"Beer, Wine &amp; Spirits (beer_and_wine)";
      NSTextCheckingResult *match = [regex firstMatchInString:testValue options:0 range:NSMakeRange(0, testValue.length)];
      for (int groupNumber=1; groupNumber&lt;match.numberOfRanges; groupNumber+=1) {
          NSRange groupRange = [match rangeAtIndex:groupNumber];
          if (groupRange.location != NSNotFound)
              NSLog(@"match %d: '%@'", groupNumber, [testValue substringWithRange:groupRange]);
          else
              NSLog(@"match %d: '%@'", groupNumber, @"");
      }
  </code></pre>
  
  <p><strong>What I want to do?</strong><br>
  From </p>
  
  <pre><code>NSString *testValue = @"Beer, Wine &amp; Spirits (beer_and_wine)";
  </code></pre>
  
  <p>I want to extract <code>beer_and_wine</code></p>
  
  <p><strong>What I get?</strong><br>
  When I run this code, nothing it matched so , nothing is printed out</p>