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-0.0.21-pp36-pypy36_pp73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5aa592cacd83eb2d864b6a15458db492b12a1034340243f66f2064820966aa3 |
|
MD5 | d472e1cfea52cc3fb1ab064cac23aad0 |
|
BLAKE2b-256 | aef6326361d10ded4b5d7eab765228cfa7685076442186a795ba3c0ca65e9d11 |
Hashes for onigurumacffi-0.0.21-pp36-pypy36_pp73-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d46cd1520b0b1262a3ab864b4e214024695967e64a09bfe885abdf624db59d4d |
|
MD5 | 5f075140958d3e4eb61d3cc7cffc8ebb |
|
BLAKE2b-256 | c5fc2fb36ef907f7091c43be3de7818538acab2a517d66e3bc891fa7de50a648 |
Hashes for onigurumacffi-0.0.21-cp36-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e2b0e5805225d9a5de3ed1576b5bbed0e8828985e1bc0954e3926e55fd7db10 |
|
MD5 | b4981c377bc078fb456249d71bd57ab9 |
|
BLAKE2b-256 | e0315c7e51f8ddfb7e8ab98c38ef221b56077c610b77c8255d6ae75d5ab13a13 |
Hashes for onigurumacffi-0.0.21-cp36-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4437d8e136fb690d77ff6c48b12a99b27f423455cd2a5b74106bff286afaa358 |
|
MD5 | 3955b19ecd1bb8c4e989396a35325639 |
|
BLAKE2b-256 | 46ac6ed56842d789c6b3522c838016c3146dd2ba45c3abf3c74b7c4a4bab52d4 |
Hashes for onigurumacffi-0.0.21-cp36-abi3-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 793d97a847d117b0c9cd1595b2ba35530b19f741734a6406df3101b12735ad8c |
|
MD5 | 4d7365b7906d87f0433d260496f03c95 |
|
BLAKE2b-256 | 3b294b5c0f05ec570d2eb6a533ea513c1af52a30e00c24f6f69867d8a8af8a1d |
Hashes for onigurumacffi-0.0.21-cp36-abi3-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c62bac488b9667e48aba7971c7c6cd5412148edb0b68bd7649fc094668f97d0e |
|
MD5 | 90fd5b054ba68ce23782da587d6aef2c |
|
BLAKE2b-256 | 60f035317a122af283db87ff1ee55876b0a00debc4e8e865d307a984a2a1078a |