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"); 

你可能感兴趣的:(正则表达式)