CocoaICU Regex Library

News

This page and the svn repository will remain for posterity.

Background

International Components for Unicode (ICU) is an open-source library for Unicode and locale-dependent tasks developed by IBM. ICU is used in many high profile projects: ICU is extensively used by Java and Apple uses ICU for regular expression support in Xcode.

Apple provides ICU (/usr/lib/libicucore.dylib) as a compiled library but does not provide any headers to link to the library. In addition, the process of properly building against the library with user-supplied ICU headers is non-trivial.

CocoaICU is a set of Objective-C classes that encapsulate the ICU regular expression library. The API for matching is based largely off of the ICU C++ API for the RegexPattern and RegexMatcher classes (which is not coincidentally very similar to the respective Java Pattern and Matcher classes).

CocoaICU is distributed under the New BSD License.

Download

Available via svn:
svn co http://aarone.org/svn/repo/Public/CocoaICU/trunk



You can browse source and see tickets at the trac instance

Requirements

10.4 or greater

Adding CocoaICU Classes To Your Project

It's a relatively straightforward process to add CocoaICU classes to your project and build against libicu:
  1. Add the files (ICUPattern.[mh], ICUMatcher.[mh], NSStringICUAdditions.[mh]) to your project and target.
  2. Add the library /usr/lib/libicucore.dylib to your project and target.
  3. Add the directory icu (included in the CocoaICU distribution) to the Header Search Path of your project.