fork(1) 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. NSString *string = @"{{nat fs g player|no=1|pos=GK|name=[[Hugo Lloris]]|age={{Birth date and age|1986|12|26|df=y}}|caps=73|goals=0|club=[[Tottenham Hotspur F.C.|Tottenham Hotspur]]|clubnat=ENG}}{{nat fs g player|no=16|pos=GK|name=[[Steve Mandanda]]|age={{Birth date and age|1985|3|28|df=y}}|caps=21|goals=0|club=[[Olympique de Marseille|Marseille]]|clubnat=FRA}}";
  9. NSError *error = NULL;
  10. NSString *pattern = @"\\{\\{nat fs g player\\|no=([^|]*)\\|pos=([^|]*)\\|name=\\[\\[([^|]*)\\]\\]\\|age=\\{\\{Birth date and age\\|([^|]*)\\|([^|]*)\\|([^|]*)\\|df=y\\}\\}\\|caps=([^|]*)\\|goals=([^|]*)\\|club=\\[\\[([^|]*)\\|(.*?\\}\\})";
  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 group0 = [match rangeAtIndex:0];
  16. NSLog(@"group0: %@", [string substringWithRange:group0]);
  17. }
  18. return 0;
  19. }
  20. @end
Success #stdin #stdout #stderr 0.04s 42888KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
2015-11-04 15:28:31.589 prog[23246] autorelease called without pool for object (0x8fc34c0) of class NSRegularExpression in thread <NSThread: 0x8f85800>
2015-11-04 15:28:31.590 prog[23246] autorelease called without pool for object (0x9021fa8) of class GSMutableArray in thread <NSThread: 0x8f85800>
2015-11-04 15:28:31.590 prog[23246] autorelease called without pool for object (0x9022a80) of class GSRegularExpressionCheckingResult in thread <NSThread: 0x8f85800>
2015-11-04 15:28:31.590 prog[23246] autorelease called without pool for object (0x8ff2aa8) of class GSRegularExpressionCheckingResult in thread <NSThread: 0x8f85800>
2015-11-04 15:28:31.590 prog[23246] autorelease called without pool for object (0x8feb820) of class GSCInlineString in thread <NSThread: 0x8f85800>
2015-11-04 15:28:31.591 prog[23246] group0: {{nat fs g player|no=1|pos=GK|name=[[Hugo Lloris]]|age={{Birth date and age|1986|12|26|df=y}}|caps=73|goals=0|club=[[Tottenham Hotspur F.C.|Tottenham Hotspur]]|clubnat=ENG}}
2015-11-04 15:28:31.591 prog[23246] autorelease called without pool for object (0x8fdf1d0) of class GSCInlineString in thread <NSThread: 0x8f85800>
2015-11-04 15:28:31.591 prog[23246] group0: {{nat fs g player|no=16|pos=GK|name=[[Steve Mandanda]]|age={{Birth date and age|1985|3|28|df=y}}|caps=21|goals=0|club=[[Olympique de Marseille|Marseille]]|clubnat=FRA}}