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.2.0-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6d3fae6fb3b70445b808b6d0209017da5390f984dcfc8977be619753290d551 |
|
MD5 | 36876e6beb9f1ff8aed7207bb9cc13b9 |
|
BLAKE2b-256 | 49102167f055287011b96313714bc7ef929b76042b10de65322491f924f8f7aa |
Hashes for onigurumacffi-1.2.0-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38a5f9879413242e7c94644d73db53d0fc7030980f19a818ff34ed1c47016fed |
|
MD5 | 0590d1d0b2efa2cac146f20ab3241e42 |
|
BLAKE2b-256 | 6398ae11f8cb0073c6f91c14f731343937f3b65af26de24df91cc2122749f457 |
Hashes for onigurumacffi-1.2.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8af421ff7370e6f5dd8202c1e5ae3140231f2744eafa0e448ef84d64fc6b8555 |
|
MD5 | 3d9dd42a48bee71d8e655959488432cd |
|
BLAKE2b-256 | 1dea47917d482214cd0a462f594d3682e9675679e4d06bbcb874d6e55179fc8d |
Hashes for onigurumacffi-1.2.0-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c836eefcec4e7e57946efd6bf54d883d7ec9396a80fdf17ba03f43289adfe77d |
|
MD5 | 766f4dcab593137e735898333b064dc0 |
|
BLAKE2b-256 | b7d6fc997529880d6bacd3810f7d740ba11a7c108569a868ed5ba83837f7bde6 |
Hashes for onigurumacffi-1.2.0-cp37-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdefc71122937d1f544160349f8c96791a90470731408ac445caae816182b1c1 |
|
MD5 | 9c41587376d7e55b47cec13842122f2d |
|
BLAKE2b-256 | 4184618e7ceda70618c6c9716ad64308dba5377db8c27b7acc231591e0e5d75e |
Hashes for onigurumacffi-1.2.0-cp37-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 468bdb34cb44e031a290da82bc652edf2a99f5749b976fecec6a62832118fd14 |
|
MD5 | bd50ae4079417543e636949ff2705138 |
|
BLAKE2b-256 | 32c6beddb3240afce609d9b1e9454bf63a9cfa33686ef8d1e02158dc884a7e12 |
Hashes for onigurumacffi-1.2.0-cp37-abi3-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | edd4e2276352283f960d57e8c657fc96f598af4cb3e7e039ce57f9a06862e0a9 |
|
MD5 | c31ba45255be6a3cf6ce3f83503bdf3e |
|
BLAKE2b-256 | 41515051847a9bc8a8f33cffa85f196e8191d3e714087c375e63f096dedf5956 |