IOS中使用正则表达式
NSString * regex = @"^.*\"success\":false{1}.*$"; NSPredicate * pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex]; BOOL isMatch = [pred evaluateWithObject:@"\"loginCallback({\"sS\":\"101\",\"iI\":false,\"iP\":true,\"success\":false});\""]; NSLog (@"%s", (isMatch) ? "YES" : "NO");