99 :(NSString *)string matchesExpression:(NSString *)regExp flags:(NSUInteger)flags
100{
101 NSAssert(![NSThread respondsToSelector:@selector(isMainThread)] || [[NSThread currentThread] isMainThread], @"OORegExpMatcher may only be used on the main thread.");
102
103 size_t expLength = [regExp length];
105
107
108
110 {
113
114 unichar *buffer;
115 buffer = malloc(expLength * sizeof *buffer);
117 [regExp getCharacters:buffer];
118
120 JSObject *regExpObj = JS_NewUCRegExpObjectNoStatics(context, buffer, expLength, (uintN)flags);
123
124 free(buffer);
125 }
126
127 BOOL result = [_tester evaluatePredicateWithContext:context
128 scope:nil
129 arguments:[NSArray arrayWithObjects:string, _cachedRegExpObject, nil]];
130
132
133 return result;
134}