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.20-pp36-pypy36_pp73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14197f92ce2dfce3fa5bd4b73d83bf9611334309871681d508cc3fa0fa0594f1 |
|
MD5 | 5bb6726e588eadc328173b5e5357af56 |
|
BLAKE2b-256 | 219c4bc710b2b2a01d21270edf3cf567e93404aa9c8206e101b31d0c42b9b519 |
Hashes for onigurumacffi-0.0.20-pp36-pypy36_pp73-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48a8b0a7725a4ff1f2a1950f59f4ab1a6ab456255233dd55489abaedf1a1f305 |
|
MD5 | 6c750e3747d9445c6c712915863a6159 |
|
BLAKE2b-256 | dea292bf35ede0aa6632fb093cd67bfcee259f7a1dfa8134bdac04a70aaa0865 |
Hashes for onigurumacffi-0.0.20-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b68e27469ea8746c6f18cb28bf39d1c34f0ed3b73b593680b7803b595021e8a |
|
MD5 | f86071cf274818930d86960844803843 |
|
BLAKE2b-256 | 3d2bb487483888696391380851e232e14a8b9becd9975a4c16b610462d2f4d59 |
Hashes for onigurumacffi-0.0.20-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d8013845ae3e784810d82ab80d0eb0231a7351a008b5d99629b3517442c7861 |
|
MD5 | 9789a48d5aea33f43a769a618c149966 |
|
BLAKE2b-256 | 7556c9e0e93d723a181baf1e6e08ef1cec109fec9e8fc3cfe0bc151ffe4c0d29 |
Hashes for onigurumacffi-0.0.20-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90d4beac915315b92ba58efd4d75b0f840640a978643aea6bfefca462a71bdb8 |
|
MD5 | 1c61b5d15e8fba81e8c329ca7edba581 |
|
BLAKE2b-256 | 2ad78d13536a5814a1610922609885b0048128fdcf5ce8b492d6e8c6110ae197 |
Hashes for onigurumacffi-0.0.20-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4af33030dee24966b99eb35581bdf9380cbac51c37608a78fa974860c631587b |
|
MD5 | 6c9258ad58262e5bd4622cd5cad66c3a |
|
BLAKE2b-256 | 821c9d27829a206ae262ffef9887224f5cae743ea06390a2a9e184eb37fa7fd3 |
Hashes for onigurumacffi-0.0.20-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5fc40311f7e5688877ba14577b8652adea529ded8d8d97e6d228a401bc7c3e8 |
|
MD5 | fcbc194ff828501a17678f085c45c70f |
|
BLAKE2b-256 | fd524a14b74418136aa21dea756a11c541e74f0dc4a7a0eaad020cf570c08d99 |
Hashes for onigurumacffi-0.0.20-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 865fd17256624a220fb26797fe269cfd01c4fb5c7963699a76746a14caa5e787 |
|
MD5 | b3ec2a03fcac8696f13a40d8cfdc70a4 |
|
BLAKE2b-256 | 42a36e4ee7001f86d285fc22c03858f6e69a4a95662bc5603b527991cdcb0096 |
Hashes for onigurumacffi-0.0.20-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02c771c4a8c0e5f864830d25728bec9f3454fc35cc108817ea197e3a398c0df5 |
|
MD5 | 2cceea92f8b867c5d347bfaa72a87d83 |
|
BLAKE2b-256 | 3269a7aa5c3891bd8932ba1427a607c98d2a909e8b3a49f5a898f9c7b06ef9f5 |
Hashes for onigurumacffi-0.0.20-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44ba53881eaefde07899161fefb11d65e6100350a43c780f638dddeb53d320a3 |
|
MD5 | b758da1dde3b888c249b89c71616d469 |
|
BLAKE2b-256 | f68ba6dca17212d699f3d46f8b3812ca5225e2d943778160c5f60764142c3974 |
Hashes for onigurumacffi-0.0.20-cp36-abi3-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 872a0e056e4a8f20dd185328986a357c20683e49ec865f11134ba4b385d832de |
|
MD5 | 270b7e9efdb599a0e751ed36a1aadb62 |
|
BLAKE2b-256 | 7a642128642f54130af76a627bfaa7bcfd59e9dd89952bb4e837e77a37851084 |
Hashes for onigurumacffi-0.0.20-cp36-abi3-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c72112b317c25c4445fa7b65642344f5ca47b3fece3b1ae910213642a726dee6 |
|
MD5 | 5401d1d43f99ee3450f47f0fb8c47415 |
|
BLAKE2b-256 | 4cc54a8f08e0650b8ab8d899b4f68857b1760d7c74c6e4d999b28a9074d9de5b |