Regular expressions in an Objective-C Cocoa application

dreeves picture dreeves · Jan 7, 2009 · Viewed 77.9k times · Source

Initial Googling indicates that there's no built-in way to do regular expressions in an Objective-C Cocoa application.

So four questions:

  1. Is that really true?

  2. Are you kidding me?

  3. Ok, then is there a nice open-source library you recommend?

  4. What are ways to get close enough without importing a library, perhaps with the NSScanner class?

Answer

Philip Jespersen picture Philip Jespersen · Aug 24, 2010

I noticed that as of iOS 4.0 Apple provides a NSRegularExpression class. Additionally, as of 10.7, the class is available under OS X.