fork download
  1. #import <objc/objc.h>
  2. #import <objc/Object.h>
  3. #import <Foundation/Foundation.h>
  4.  
  5. int main()
  6. {
  7. NSError *error = nil;
  8. NSString *string = @"FIRSTEXAMPLEEXAMPLETEST";
  9. NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"(.+)\\1+" options:nil error:&error];
  10. NSString *modifiedString = [regex stringByReplacingMatchesInString:string options:0 range:NSMakeRange(0, [string length]) withTemplate:@"$1"];
  11. NSLog(@"%@", modifiedString); // => FIRSTEXAMPLETEST
  12. return 0;
  13. }
  14.  
Success #stdin #stdout #stderr 0.01s 42904KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
2016-09-14 11:39:07.479 prog[10447] autorelease called without pool for object (0x99345b8) of class NSRegularExpression in thread <NSThread: 0x98f6908>
2016-09-14 11:39:07.480 prog[10447] FIRSTEXAMPLETEST