fork(4) download
  1. #import <objc/objc.h>
  2. #import <objc/Object.h>
  3. #import <Foundation/Foundation.h>
  4.  
  5. @implementation TestObj
  6. int main()
  7. {
  8. NSError *error = nil;
  9. NSString *pattern = @"\"my_id\": \"([^\"]+)";
  10. NSString *string = @"dsadasdasd\"my_id\": \"qwerr\"dcdscsdcds\"my_id\": \"oytuj\"adasddasddsddaS\"my_id\": \"sjghjgjg\"ddsfsdfsdf";
  11. NSRange range = NSMakeRange(0, string.length);
  12. NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern options:0 error:&error];
  13. NSArray *matches = [regex matchesInString:string options:0 range:range];
  14. for (NSTextCheckingResult* match in matches) {
  15. NSRange group1 = [match rangeAtIndex:1];
  16. NSLog(@"group1: %@", [string substringWithRange:group1]);
  17. }
  18. return 0;
  19. }
  20. @end
Success #stdin #stdout #stderr 0.05s 42896KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
2015-10-27 10:32:56.304 prog[1402] autorelease called without pool for object (0x92234c0) of class NSRegularExpression in thread <NSThread: 0x91e5800>
2015-10-27 10:32:56.305 prog[1402] autorelease called without pool for object (0x9281030) of class GSMutableArray in thread <NSThread: 0x91e5800>
2015-10-27 10:32:56.306 prog[1402] autorelease called without pool for object (0x9281b68) of class GSRegularExpressionCheckingResult in thread <NSThread: 0x91e5800>
2015-10-27 10:32:56.306 prog[1402] autorelease called without pool for object (0x9283668) of class GSRegularExpressionCheckingResult in thread <NSThread: 0x91e5800>
2015-10-27 10:32:56.306 prog[1402] autorelease called without pool for object (0x9251ba8) of class GSRegularExpressionCheckingResult in thread <NSThread: 0x91e5800>
2015-10-27 10:32:56.306 prog[1402] autorelease called without pool for object (0x927b278) of class GSCInlineString in thread <NSThread: 0x91e5800>
2015-10-27 10:32:56.306 prog[1402] group1: qwerr
2015-10-27 10:32:56.306 prog[1402] autorelease called without pool for object (0x9248320) of class GSCInlineString in thread <NSThread: 0x91e5800>
2015-10-27 10:32:56.306 prog[1402] group1: oytuj
2015-10-27 10:32:56.306 prog[1402] autorelease called without pool for object (0x9248cb8) of class GSCInlineString in thread <NSThread: 0x91e5800>
2015-10-27 10:32:56.306 prog[1402] group1: sjghjgjg