k-takata/Onigmo logo

k-takata/Onigmo

Free

Onigmo is a regular expressions library forked from Oniguruma.

FreeFree tier
Type
Open Source

About k-takata/Onigmo

Onigmo is a regular expressions library forked from Oniguruma. It focuses on supporting new expressions like \K, \R, and conditional patterns (?(cond)yes|no) that are available in Perl 5.10 and later. It is used as the default regexp library in Ruby 2.0 and later, with many patches backported from Ruby. The library is released under a BSD license and supports multiple platforms including Unix, Cygwin, Windows (Visual C++ and MinGW), and MSYS2. It provides a C API, Python bindings, and includes comprehensive documentation and test suites.

Key Features

Supports new expressions from Perl 5.10+ such as \K, \R, and conditional patterns (?(cond)yes|no)
Default regular expression library in Ruby 2.0 and later, with backported patches from Ruby 2.x
BSD license allowing free use and redistribution
Cross-platform support: Unix, Cygwin, Windows (Visual C++ and MinGW), MSYS2
Includes Python bindings (onigmo.py) for use with Python
Comprehensive documentation: regex syntax (doc/RE), API (doc/API), and Japanese documentation available
Supports multiple character encodings: ASCII, Shift_JIS, EUC-JP, Unicode (UTF-8, etc.)
Provides both static and dynamic link libraries for Windows

Pros & Cons

Pros
  • Supports modern Perl-like regex features including \K, \R, and conditionals
  • BSD licensed, allowing both open-source and proprietary use
  • Actively maintained with contributions backported from Ruby
  • Cross-platform support with multiple build options
  • Thorough documentation and test suite (including Python tests)
Cons
  • Primarily a regex library; does not include higher-level text processing or parsing tools
  • May have a learning curve for users not familiar with Oniguruma or Perl regex syntax
  • Not an AI or machine learning tool; limited to regular expression functionality
  • Documentation and community are smaller compared to alternatives like PCRE or RE2

Best For

Providing advanced regex capabilities in Ruby applications (default engine since Ruby 2.0)Embedding Perl-compatible regex support in C/C++ applicationsText processing and pattern matching in cross-platform softwareUsed as a foundation for other tools that require modern regex syntax

FAQ

What license does Onigmo use?
Onigmo is released under the BSD license.
How do I install Onigmo on Unix?
Run ./autogen.sh (if configure doesn't exist), then ./configure, make, make install. Use 'make test' to run tests.
How do I install Onigmo on Windows with Visual C++?
Execute build_nmake.cmd. The build will produce onigmo_s.lib (static), onigmo.lib (import library), and onigmo.dll (dynamic link library). Run 'build_nmake.cmd test' to execute tests.
Does Onigmo support Python?
Yes, the repository includes onigmo.py which provides Python bindings. Python is required to run the test suite.
Is Onigmo compatible with Oniguruma?
Onigmo is a fork of Oniguruma and aims to be compatible while adding Perl 5.10+ features.
What encoding types does Onigmo support?
Onigmo supports ASCII, Shift_JIS, EUC-JP, and Unicode (UTF-8 and others based on oniguruma).