fork 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 = @"@user hey heres my message: first message: and a second colon! haha.";
  9. NSError *error = NULL;
  10. NSString *pattern = @"^.*?:\\s+(.*?[!.?](?=\\s)|[^\"]*).*$";
  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 0s 131712KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
2017-04-03 19:04:21.545 prog[32267:32267] autorelease called without pool for object (0x2b8c01b86980) of class NSRegularExpression in thread <NSThread: 0x2b8c01b89880>{name = (null), num = 32267}
2017-04-03 19:04:21.591 prog[32267:32267] autorelease called without pool for object (0x2b8c01da7180) of class GSMutableArray in thread <NSThread: 0x2b8c01b89880>{name = (null), num = 32267}
2017-04-03 19:04:21.591 prog[32267:32267] autorelease called without pool for object (0x2b8c01da6cc0) of class GSRegularExpressionCheckingResult in thread <NSThread: 0x2b8c01b89880>{name = (null), num = 32267}
2017-04-03 19:04:21.591 prog[32267:32267] autorelease called without pool for object (0x2b8c01da55d0) of class GSCInlineString in thread <NSThread: 0x2b8c01b89880>{name = (null), num = 32267}
2017-04-03 19:04:21.591 prog[32267:32267] autorelease called without pool for object (0x2b8c01caeb30) of class NSCalendarDate in thread <NSThread: 0x2b8c01b89880>{name = (null), num = 32267}
2017-04-03 19:04:21.591 prog[32267:32267] autorelease called without pool for object (0x2b8c01d9b130) of class GSDictionary in thread <NSThread: 0x2b8c01b89880>{name = (null), num = 32267}
2017-04-03 19:04:21.591 prog[32267:32267] autorelease called without pool for object (0x2b8c01da7490) of class GSTimeZone in thread <NSThread: 0x2b8c01b89880>{name = (null), num = 32267}
2017-04-03 19:04:21.591 prog[32267:32267] autorelease called without pool for object (0x2b8c01b819a0) of class GSCInlineString in thread <NSThread: 0x2b8c01b89880>{name = (null), num = 32267}
2017-04-03 19:04:21.591 prog[32267:32267] autorelease called without pool for object (0x2b8c01da5db0) of class NSDataMalloc in thread <NSThread: 0x2b8c01b89880>{name = (null), num = 32267}
2017-04-03 19:04:21.591 prog[32267:32267] group1: first message: and a second colon!