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.3.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b2187f4722ffee8b1e7e529d1998c8abb2236da19bafc59bce881c335f53d6e |
|
MD5 | b0fa32d5556275136c4d3fc8c3811c06 |
|
BLAKE2b-256 | 3bd71fad16190046997419bbc2526e14d9274943eba5454677289dde76527dce |
Hashes for onigurumacffi-1.3.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c1f34f9f6cd5185a1ed1146ccbf2e9d808b508816a13b6ed8b1550e2a246f79 |
|
MD5 | ace70596db04666ec328511385147b02 |
|
BLAKE2b-256 | 018cd249263e4b58b95d480f7c90f19ff271d9a5e14c9b2725136beb7acbec28 |
Hashes for onigurumacffi-1.3.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 094b22f59bbc12812272686e468e3956a8a34262f3ee79e6ebea60ac12756713 |
|
MD5 | 48f89c655fa8a58a377d2537373c1beb |
|
BLAKE2b-256 | fff78de1d8874ab681ed4d9d6a132768850b77191e7cc4933895ada86d09407f |
Hashes for onigurumacffi-1.3.0-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45fcb24ebce96e884c34e5b93e46b371e21a9a4cb85c386a3359a5eacab31575 |
|
MD5 | 853a455559bad7214d360efc23bcb60d |
|
BLAKE2b-256 | 64be0cf9a7494d0ce25e5c715b05c73e401eb2274c3d65ef34ab7b1238d6bbf0 |
Hashes for onigurumacffi-1.3.0-cp38-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31a22befe51ce2ce0c56936edeccbbca5f8e63c0808baf8e108e04642edc5091 |
|
MD5 | 687b1b93d4b14c7aab3f8a3e78f144e6 |
|
BLAKE2b-256 | d5b150515e8e28699cc533b9ef3d5f9b017e2533e93aab3b3cdb16e8d12ff512 |
Hashes for onigurumacffi-1.3.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fc00956c5e824373f5b59c1714470472f8df162db773166aeae9cc4d80a1245 |
|
MD5 | 64b89cf45c7a9980cc7ca1f83d2cc241 |
|
BLAKE2b-256 | 9567d79921bc9645d692932d338465427f7486f6f00edd714b5b3aaccf92dd07 |
Hashes for onigurumacffi-1.3.0-cp38-abi3-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77d3f174df2195f2af5968170a5286094c30f32f5d80a6c9c7df90fcdd4b545c |
|
MD5 | 82923e980bbf1fa0d43dcab8e1e7c43d |
|
BLAKE2b-256 | 3de209aacddcd1a0193c2edb509b3d9de60b5db3bfe17e0240d8888f2e4d2f67 |
Hashes for onigurumacffi-1.3.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63097f9963c7d47ee4c4106bfa0bb9be59b37d8e194c892e3f617ec964ab7ddb |
|
MD5 | 19079f391a984323a084c1aff54104df |
|
BLAKE2b-256 | a2cc8aa9e3345a33bd2ff9454b94ca5e72694667deb642aab636cca1a8808294 |