| 1 |
[](https://travis-ci.org/k-takata/Onigmo) |
| 2 |
[](https://ci.appveyor.com/project/k-takata/onigmo/branch/master) |
| 3 |
[](https://coveralls.io/github/k-takata/Onigmo?branch=master) |
| 4 |
[](https://scan.coverity.com/projects/k-takata-onigmo) |
| 5 |
|
| 6 |
Onigmo (Oniguruma-mod) |
| 7 |
====================== |
| 8 |
|
| 9 |
https://github.com/k-takata/Onigmo |
| 10 |
|
| 11 |
Onigmo is a regular expressions library forked from [Oniguruma](https://github.com/kkos/oniguruma). |
| 12 |
It focuses to support new expressions like `\K`, `\R`, `(?(cond)yes|no)` |
| 13 |
and etc. which are supported in Perl 5.10+. |
| 14 |
|
| 15 |
Since Onigmo is used as the default regexp library of Ruby 2.0 or later, |
| 16 |
many patches are backported from Ruby 2.x. |
| 17 |
|
| 18 |
See also the Wiki page: |
| 19 |
https://github.com/k-takata/Onigmo/wiki |
| 20 |
|
| 21 |
|
| 22 |
License |
| 23 |
------- |
| 24 |
|
| 25 |
BSD license. |
| 26 |
|
| 27 |
|
| 28 |
Install |
| 29 |
------- |
| 30 |
|
| 31 |
### Case 1: Unix and Cygwin platform |
| 32 |
|
| 33 |
1. `./configure` |
| 34 |
2. `make` |
| 35 |
3. `make install` |
| 36 |
|
| 37 |
* test |
| 38 |
|
| 39 |
make test |
| 40 |
|
| 41 |
* uninstall |
| 42 |
|
| 43 |
make uninstall |
| 44 |
|
| 45 |
* configuration check |
| 46 |
|
| 47 |
onigmo-config --cflags |
| 48 |
onigmo-config --libs |
| 49 |
onigmo-config --prefix |
| 50 |
onigmo-config --exec-prefix |
| 51 |
|
| 52 |
|
| 53 |
### Case 2: Windows 64/32bit platform (Visual C++) |
| 54 |
|
| 55 |
Execute `build_nmake.cmd`. |
| 56 |
`build_x64` or `build_x86` will be used as a working/output directory. |
| 57 |
|
| 58 |
onigmo_s.lib: static link library |
| 59 |
onigmo.lib: import library for dynamic link |
| 60 |
onigmo.dll: dynamic link library |
| 61 |
|
| 62 |
* test (ASCII/Shift_JIS/EUC-JP/Unicode) |
| 63 |
|
| 64 |
Execute `build_nmake.cmd test`. |
| 65 |
Python (with the same bitness of Onigmo) is needed to run the tests. |
| 66 |
|
| 67 |
|
| 68 |
### Case 3: Windows 64/32bit platform (MinGW) |
| 69 |
|
| 70 |
Execute `mingw32-make -f win32/Makefile.mingw`. |
| 71 |
`build_x86-64`, `build_i686` and etc. will be used as a working/output |
| 72 |
directory. |
| 73 |
|
| 74 |
libonigmo.a: static link library |
| 75 |
libonigmo.dll.a: import library for dynamic link |
| 76 |
onigmo.dll: dynamic link library |
| 77 |
|
| 78 |
* test (ASCII/Shift_JIS/EUC-JP/Unicode) |
| 79 |
|
| 80 |
Execute `mingw32-make -f win32/Makefile.mingw test`. |
| 81 |
Python (with the same bitness of Onigmo) is needed to run the tests. |
| 82 |
|
| 83 |
* If you use MinGW on MSYS2, you can also use `./configure` and `make` |
| 84 |
like Unix. In this case, DLL name will have API version number. E.g.: |
| 85 |
|
| 86 |
libonigmo-6.dll |
| 87 |
|
| 88 |
|
| 89 |
Regular Expressions |
| 90 |
------------------- |
| 91 |
|
| 92 |
See [doc/RE](doc/RE) or [doc/RE.ja](doc/RE.ja) for Japanese. |
| 93 |
|
| 94 |
|
| 95 |
Usage |
| 96 |
----- |
| 97 |
|
| 98 |
Include onigmo.h in your program. (Onigmo API) |
| 99 |
See [doc/API](doc/API) for Onigmo API. |
| 100 |
|
| 101 |
If you want to disable `UChar` type (== `unsigned char`) definition |
| 102 |
in onigmo.h, define `ONIG_ESCAPE_UCHAR_COLLISION` and then |
| 103 |
include onigmo.h. |
| 104 |
|
| 105 |
If you want to disable `regex_t` type definition in onigmo.h, |
| 106 |
define `ONIG_ESCAPE_REGEX_T_COLLISION` and then include onigmo.h. |
| 107 |
|
| 108 |
Example of the compiling/linking command line in Unix or Cygwin, |
| 109 |
(prefix == /usr/local case) |
| 110 |
|
| 111 |
cc sample.c -L/usr/local/lib -lonigmo |
| 112 |
|
| 113 |
|
| 114 |
If you want to use static link library (onigmo_s.lib) in Win32, |
| 115 |
add option `-DONIG_EXTERN=extern` to C compiler. |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
Sample Programs |
| 120 |
--------------- |
| 121 |
|
| 122 |
|File |Description | |
| 123 |
|:---------------------|:-----------------------------------------| |
| 124 |
|sample/simple.c |example of the minimum (Onigmo API) | |
| 125 |
|sample/names.c |example of the named group callback. | |
| 126 |
|sample/encode.c |example of some encodings. | |
| 127 |
|sample/listcap.c |example of the capture history. | |
| 128 |
|sample/posix.c |POSIX API sample. | |
| 129 |
|sample/sql.c |example of the variable meta characters. | |
| 130 |
|
| 131 |
|
| 132 |
Test Programs |
| 133 |
|
| 134 |
|File |Description | |
| 135 |
|:------------------|:--------------------------------------| |
| 136 |
|sample/syntax.c |Perl, Java and ASIS syntax test. | |
| 137 |
|sample/crnl.c |CRNL test | |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
Source Files |
| 142 |
------------ |
| 143 |
|
| 144 |
|File |Description | |
| 145 |
|:-------------------|:------------------------------------------------------| |
| 146 |
|onigmo.h |Onigmo API header file (public) | |
| 147 |
|onigmo-config.in |configuration check program template | |
| 148 |
|onigmo.py |Onigmo module for Python | |
| 149 |
|regenc.h |character encodings framework header file | |
| 150 |
|regint.h |internal definitions | |
| 151 |
|regparse.h |internal definitions for regparse.c and regcomp.c | |
| 152 |
|regcomp.c |compiling and optimization functions | |
| 153 |
|regenc.c |character encodings framework | |
| 154 |
|regerror.c |error message function | |
| 155 |
|regext.c |extended API functions (deluxe version API) | |
| 156 |
|regexec.c |search and match functions | |
| 157 |
|regparse.c |parsing functions. | |
| 158 |
|regsyntax.c |pattern syntax functions and built-in syntax definition| |
| 159 |
|regtrav.c |capture history tree data traverse functions | |
| 160 |
|regversion.c |version info function | |
| 161 |
|st.h |hash table functions header file | |
| 162 |
|st.c |hash table functions | |
| 163 |
|onigmognu.h |GNU regex API header file (public) | |
| 164 |
|reggnu.c |GNU regex API functions | |
| 165 |
|onigmoposix.h |POSIX API header file (public) | |
| 166 |
|regposerr.c |POSIX error message function | |
| 167 |
|regposix.c |POSIX API functions | |
| 168 |
|enc/mktable.c |character type table generator | |
| 169 |
|enc/ascii.c |ASCII-8BIT encoding | |
| 170 |
|enc/jis/ |JIS properties data | |
| 171 |
|enc/euc_jp.c |EUC-JP encoding | |
| 172 |
|enc/euc_tw.c |EUC-TW encoding | |
| 173 |
|enc/euc_kr.c |EUC-KR, EUC-CN encoding | |
| 174 |
|enc/shift_jis.c |Shift_JIS encoding | |
| 175 |
|enc/windows_31j.c |Windows-31J (CP932) encoding | |
| 176 |
|enc/big5.c |Big5 encoding | |
| 177 |
|enc/gb18030.c |GB18030 encoding | |
| 178 |
|enc/gbk.c |GBK encoding | |
| 179 |
|enc/koi8_r.c |KOI8-R encoding | |
| 180 |
|enc/koi8_u.c |KOI8-U encoding | |
| 181 |
|enc/iso_8859.h |common definition of ISO-8859 encoding | |
| 182 |
|enc/iso_8859_1.c |ISO-8859-1 (Latin-1) | |
| 183 |
|enc/iso_8859_2.c |ISO-8859-2 (Latin-2) | |
| 184 |
|enc/iso_8859_3.c |ISO-8859-3 (Latin-3) | |
| 185 |
|enc/iso_8859_4.c |ISO-8859-4 (Latin-4) | |
| 186 |
|enc/iso_8859_5.c |ISO-8859-5 (Cyrillic) | |
| 187 |
|enc/iso_8859_6.c |ISO-8859-6 (Arabic) | |
| 188 |
|enc/iso_8859_7.c |ISO-8859-7 (Greek) | |
| 189 |
|enc/iso_8859_8.c |ISO-8859-8 (Hebrew) | |
| 190 |
|enc/iso_8859_9.c |ISO-8859-9 (Latin-5 or Turkish) | |
| 191 |
|enc/iso_8859_10.c |ISO-8859-10 (Latin-6 or Nordic) | |
| 192 |
|enc/iso_8859_11.c |ISO-8859-11 (Thai) | |
| 193 |
|enc/iso_8859_13.c |ISO-8859-13 (Latin-7 or Baltic Rim) | |
| 194 |
|enc/iso_8859_14.c |ISO-8859-14 (Latin-8 or Celtic) | |
| 195 |
|enc/iso_8859_15.c |ISO-8859-15 (Latin-9 or West European with Euro) | |
| 196 |
|enc/iso_8859_16.c |ISO-8859-16 (Latin-10) | |
| 197 |
|enc/utf_8.c |UTF-8 encoding | |
| 198 |
|enc/utf_16be.c |UTF-16BE encoding | |
| 199 |
|enc/utf_16le.c |UTF-16LE encoding | |
| 200 |
|enc/utf_32be.c |UTF-32BE encoding | |
| 201 |
|enc/utf_32le.c |UTF-32LE encoding | |
| 202 |
|enc/unicode.c |common codes of Unicode encoding | |
| 203 |
|enc/unicode/ |Unicode case folding data and properties data | |
| 204 |
|enc/windows_1250.c |Windows-1250 (CP1250) encoding (Central/Eastern Europe)| |
| 205 |
|enc/windows_1251.c |Windows-1251 (CP1251) encoding (Cyrillic) | |
| 206 |
|enc/windows_1252.c |Windows-1252 (CP1252) encoding (Latin) | |
| 207 |
|enc/windows_1253.c |Windows-1253 (CP1253) encoding (Greek) | |
| 208 |
|enc/windows_1254.c |Windows-1254 (CP1254) encoding (Turkish) | |
| 209 |
|enc/windows_1257.c |Windows-1257 (CP1257) encoding (Baltic Rim) | |
| 210 |
|enc/cp949.c |CP949 encoding (only used in Ruby) | |
| 211 |
|enc/emacs_mule.c |Emacs internal encoding (only used in Ruby) | |
| 212 |
|enc/gb2312.c |GB2312 encoding (only used in Ruby) | |
| 213 |
|enc/us_ascii.c |US-ASCII encoding (only used in Ruby) | |
| 214 |
|win32/Makefile |Makefile for Win32 (VC++) | |
| 215 |
|win32/Makefile.mingw|Makefile for Win32 (MinGW) | |
| 216 |
|win32/config.h |config.h for Win32 | |
| 217 |
|win32/onigmo.rc |resource file for Win32 | |