{"id":133,"date":"2008-09-20T14:21:53","date_gmt":"2008-09-20T19:21:53","guid":{"rendered":"http:\/\/vgable.com\/blog\/2008\/09\/20\/regex-matching-and-filtering-in-cocoa-with-nspredicate\/"},"modified":"2008-09-20T14:21:55","modified_gmt":"2008-09-20T19:21:55","slug":"regex-matching-and-filtering-in-cocoa-with-nspredicate","status":"publish","type":"post","link":"https:\/\/vgable.com\/blog\/2008\/09\/20\/regex-matching-and-filtering-in-cocoa-with-nspredicate\/","title":{"rendered":"Regex Matching and Filtering in Cocoa With NSPredicate"},"content":{"rendered":"<p>Apples documentation of <a href=\"http:\/\/developer.apple.com\/documentation\/Cocoa\/Conceptual\/Predicates\/Articles\/pUsing.html#\/\/apple_ref\/doc\/uid\/TP40001794-DontLinkElementID_15\">Regular Expressions With <code>NSPredicate<\/code><\/a> has the full scoop, but basically you do<br \/>\n<code>[NSPredicate predicateWithFormat:@\"SELF MATCHES <em>regex-here<\/em>\"];<\/code>.  Unfortunately, you can only test if strings match a regex.  You can not use an <code>NSPredicate<\/code>-regex to extract parts of a string.  Depending on what you need to do, this may or may not be enough to <a href=\"http:\/\/xkcd.com\/208\/\">save the day<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apples documentation of Regular Expressions With NSPredicate has the full scoop, but basically you do [NSPredicate predicateWithFormat:@&#8221;SELF MATCHES regex-here&#8221;];. Unfortunately, you can only test if strings match a regex. You can not use an NSPredicate-regex to extract parts of a string. Depending on what you need to do, this may or may not be enough [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,3,5,4],"tags":[182,148,180,181],"class_list":["post-133","post","type-post","status-publish","format-standard","hentry","category-cocoa","category-macosx","category-objective-c","category-programming","tag-filter","tag-nspredicate","tag-regex","tag-regular-expressions"],"_links":{"self":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/comments?post=133"}],"version-history":[{"count":0,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/133\/revisions"}],"wp:attachment":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/media?parent=133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/categories?post=133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/tags?post=133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}