Version 12 (modified by psychs, 9 years ago)



CocoaOniguruma is an Objective-C binding of Oniguruma regular expression engine.

It's simple and tiny compared to the other bindings.


git clone git://

How to use

CocoaOniguruma is designed as a static link library not a framework.

Follow the steps to use CocoaOniguruma in your project.

  1. Copy "core" directory into your project directory with name "CocoaOniguruma". (Assume your project name is "YourProject" here.)
  2. Open your project by Xcode.
  3. Add all .h and .m files under "Classes".
    1. Right click on "Classes" and select [Add] -> [Existing Files...].
    2. Select the following files and push the OK button.
      • OnigRegexp.h
      • OnigRegexp.m
      • OnigRegexpUtility.h
      • OnigRegexpUtility.m
  4. Add an external target under Targets.
    1. Right click on Targets and select [Add] -> [New Target...].
    2. In the Assistant dialog, select "External Target" under "Special Targets".
    3. Input "CocoaOniguruma" for "Target Name".
    4. Double click on the CocoaOniguruma target under "Targets".
    5. In the dialog, input "CocoaOniguruma/oniguruma" for "Directory" under "Custom Build Command".
  5. Add the external target to the build process.
    1. Drag the CocoaOniguruma target item into "YourProject" item under "Targets". Then you can see the CocoaOniguruma target item under "YourProject".
  6. Build the project. (This takes for a while. Then you will see some link errors, but it's no problem. Go ahead.)
  7. Add libonig.a to "Linked Frameworks".
    1. Expand "Frameworks" item.
    2. Right click on "Linked Frameworks" and select [Add] -> [Existing Files...].
    3. Select "CocoaOniguruma/oniguruma/universal/libonig.a".
  8. Import the header file, so you can use CocoaOniguruma.
    #import "CocoaOniguruma/OnigRegexp.h"

The Author


The revised BSD license.

See also the Oniguruma's COPYING file.