python cffi bindings for the oniguruma regex engine
Project description
onigurumacffi
python cffi bindings for the oniguruma regex engine
installation
pip install onigurumacffi
- wheels should be available on pypi in most cases
- to build from source,
libonig-dev
must be installed prior to installation
api
the api is currently very limited (basically just enough to support what I needed).
compile(pattern: str) -> _Pattern
make a compiled pattern
compile_regset(*patterns: str) -> _RegSet
make a compiled RegSet
OnigSearchOption
an enum listing the search-time options for oniguruma
the current set of options are:
class OnigSearchOption(enum.IntEnum):
NONE = ...
NOTBOL = ...
NOTEOL = ...
POSIX_REGION = ...
CHECK_VALIDITY_OF_STRING = ...
NOT_BEGIN_STRING = ...
NOT_BEGIN_POSITION = ...
_Pattern.match(s: str, start: int = 0, flags: OnigSearchOption = OnigSearchOption.NONE) -> Optional[_Match]
match a string using the pattern. optionally set start
to adjust the offset
which is searched from
_Pattern.search(s: str, start: int = 0, flags: OnigSearchOption = OnigSearchOption.NONE) -> Optional[_Match]
search a string using the pattern. optionally set start
to adjust the offset
which is searched from
_Pattern.number_of_captures() -> int
return the number of captures in the regex
_RegSet.search(s: str, start: int = 0, flags: OnigSearchOption = OnigSearchOption.NONE) -> Tuple[int, Optional[_Match]]
search a string using the RegSet. optionally set start
to adjust the offset
which is searched from
the leftmost regex index and match is returned or (-1, None)
if there is no
match
_Match.group(n: int = 0) -> str
return the string of the matched group, defaults to 0 (the whole match)
_Match[n: int] -> str
a shorthand alias for _Match.group(...)
_Match.start(n: int = 0) -> int
return the character position of the start of the matched group, defaults to 0 (the whole match)
_Match.end(n: int = 0) -> int
return the character position of the end of the matched group, defaults to 0 (the whole match)
_Match.span(n: int = 0) -> int
return (start, end)
character position of the matched group, defaults to 0
(the whole match)
_Match.expand(s: str) -> str
expand numeric groups in s
via the groups in the match
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for onigurumacffi-1.1.0-pp37-pypy37_pp73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83a031a11cc16aea7c13e513e1b7eff35157cfda4fcc6e561a4b50f4e2eabe75 |
|
MD5 | e61da0aa6176dd83623264b0eeadb48b |
|
BLAKE2b-256 | 2952d3e15bf0229207d598f16a32859c4064990040f63a5e30633ecdf44d6c23 |
Hashes for onigurumacffi-1.1.0-pp37-pypy37_pp73-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1dcbefbe113e26467e8464434f4fae81ad9a8b813c8766161970114c5aade920 |
|
MD5 | f7f55092a4fb7975499f1c6fb2ecf0f8 |
|
BLAKE2b-256 | 408793769b0140d9284216a67a468d1b798176309d833cc8995a540ea69c736d |
Hashes for onigurumacffi-1.1.0-pp36-pypy36_pp73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2b1b9813d791a292b71f7fd28d76d9e3e5d2f17b7872e6b1563419e041e9a1f |
|
MD5 | 4b3c51be0013a28befa3551725fa4429 |
|
BLAKE2b-256 | f117bd469ab8f2e2cb8287ae9185db46e3b9cb61fdec42078241fd9b715133c8 |
Hashes for onigurumacffi-1.1.0-pp36-pypy36_pp73-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 357bad8c80ffcf923de916002703bdff15a7eaefdd0da009f5b7b64ae841bc71 |
|
MD5 | 058ff78566fff1f62356f141d357139c |
|
BLAKE2b-256 | 1743f2919ff066a308396ab797f1f8cbd5a61f389466843b7c26fec1fa3fd41d |
Hashes for onigurumacffi-1.1.0-cp38-abi3-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 668bc947afcc4da36c4c3b0cb5c33e0ec023aeb420c1a61671d4d4e926f2f683 |
|
MD5 | ca2bc1f19bfcb6ede484c7990a2442fa |
|
BLAKE2b-256 | b1f1a602de59169bc1078f2db677bf427e7c1627733125a44977679c30d8d929 |
Hashes for onigurumacffi-1.1.0-cp36-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 688c4e0567cab0d599f210cc6cf60c876cb3e6adb1ad0b3d0b782d929cbee560 |
|
MD5 | 3913c6ef3dd0e46c7e21bea02902454a |
|
BLAKE2b-256 | 2f246079260b15703ecc783023093c97fa090a675cb24f7346b9cece772a5e88 |
Hashes for onigurumacffi-1.1.0-cp36-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d23f5cfaff3dd785d2420582d5a2e4c192a4cff22293713e133a466ceb615cc4 |
|
MD5 | 5eddc3e15f1098f39b1c4ae1acbcc67f |
|
BLAKE2b-256 | b3973babbfc95097738349c7e0c7594e811cfa639224c2205ba050f73ac7dc52 |
Hashes for onigurumacffi-1.1.0-cp36-abi3-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0374a4321fd8a0edd466b9c83d5e0ec5bd3a514f49c44c1f494bf6d8715c9aa5 |
|
MD5 | 4172d1feb1c63cdcdb711d534ede7f07 |
|
BLAKE2b-256 | 40ae3e64fd0ea1a5fc1365d419c0a9a317073b72c2571fc4445c793b41d7f577 |
Hashes for onigurumacffi-1.1.0-cp36-abi3-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84b25f8f73421ecff249e3cba853a8b999bc993a120e87bdd0d958171039bd7d |
|
MD5 | 65e926aa928d11ff5f610310854396eb |
|
BLAKE2b-256 | 746c7afb7666916923f52d2450f13408f0df296c7f18885a413d9cfd2abbc634 |