fork download
  1. #import <objc/objc.h>
  2. #import <objc/Object.h>
  3. #import <Foundation/Foundation.h>
  4.  
  5. int main()
  6. {
  7. NSString *searchedString = @"𠀀"; // First character (U+20000)
  8. NSString *pattern = @"[\\U00020000-\\U0002A6DF]+";
  9. NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern options:NSRegularExpressionCaseInsensitive error:nil];
  10. if ([regex numberOfMatchesInString:searchedString options:0 range:NSMakeRange(0, [searchedString length])] > 0) {
  11. NSLog(@"matches");
  12. } else {
  13. NSLog(@"doesn't match");
  14. }
  15. return 0;
  16. }
  17.  
Success #stdin #stdout #stderr 0.01s 42904KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
2016-12-08 10:07:24.077 prog[12098] autorelease called without pool for object (0x91df5b8) of class NSRegularExpression in thread <NSThread: 0x91a1908>
2016-12-08 10:07:24.077 prog[12098] matches