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.19-pp36-pypy36_pp73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e60cf514763564375a7a2ff09d12b341b3d41cb0cd959026c9404ea8d42f389b |
|
MD5 | 4166516d1d86580d6c95d9a7f38001d7 |
|
BLAKE2b-256 | 38e71ce2224c52963f623c45ae751e646126f72575afd310cd5f891afc0ed3c7 |
Hashes for onigurumacffi-0.0.19-pp36-pypy36_pp73-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7189a67b6b809ab54f6eb1fe4bdf81d1ca88ce042bbac1588f7833dbf3ba2ef2 |
|
MD5 | 7a496a76ea90dc25c698151f1a364195 |
|
BLAKE2b-256 | 8cd08af799cd9a8233a8feb522a86bfd13a77e6e597cd96b189451278abb61ee |
Hashes for onigurumacffi-0.0.19-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9697a11439c8a24c7bf513136e9d4185fdb853eb71044587db8bc04f848e07b5 |
|
MD5 | 09067a2707c6e4d004d8f4f9f5dcf6d0 |
|
BLAKE2b-256 | e75076b06a029e9f7a3c5c1033b631bbbe399818296fac1b3cbe6562f9e393b7 |
Hashes for onigurumacffi-0.0.19-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6e814cbd1e59a090b80df7614034c6e8da436d59f1d8667f801666cb49099a4 |
|
MD5 | c427140831eed7cc95a3687ca22a2246 |
|
BLAKE2b-256 | f832ee5a7993c081640c1669f0de8675ca2f9b4d01a58533ffb4393d8d9a2447 |
Hashes for onigurumacffi-0.0.19-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbd0589365dd75a5bafc1923dda450c484e295b4b077477c0e9f91e070394801 |
|
MD5 | cf52e79499900969bd72d750f0c94985 |
|
BLAKE2b-256 | 8ccb6f25eddbfa392745600878304c32200fb56847f49ff540d04ced3800e034 |
Hashes for onigurumacffi-0.0.19-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b8d8711a0a9f93aca5e443154fb8e7da9d9b4a6d1ee4ade28105879dbf84e58 |
|
MD5 | 409855071c924abd2128834d258215b0 |
|
BLAKE2b-256 | c41143ca5888e63d31a1a40f9ad2e69608d2c324694c41457803830f860c4ec5 |
Hashes for onigurumacffi-0.0.19-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 113ff1a631c4ce3802095b0cbd3c4d9b879ace598f544e98273004499809b235 |
|
MD5 | f667de0b28076684d954cb8a97115694 |
|
BLAKE2b-256 | c390d0761a2757e7416c1a1342f8cba1fbb7a851c649643704842586a9fd688b |
Hashes for onigurumacffi-0.0.19-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92fee0de96602dcf3e39dd8687f1b69058648df322f349cc05f98f50cdd18933 |
|
MD5 | fa6a0f3cbfc76d7f3686bdc35630ad98 |
|
BLAKE2b-256 | 17f6b2677009895843ff765c847478042c2887ab3235bef4dd64b3a7473c4480 |
Hashes for onigurumacffi-0.0.19-cp36-abi3-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 223c8a991f6890ab8672423b048fc747ca6f4125079f37f3f5a9e41d243f1f05 |
|
MD5 | bf80a8be3a0b10720be0b6f155cf784e |
|
BLAKE2b-256 | eac9f982dd0f1678670cd9dc3ccabff8d3cdfdfbc2091ebd4d4073b11cb81a58 |
Hashes for onigurumacffi-0.0.19-cp36-abi3-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d3efb908eedf10c26013cd5300cdf11e3019cce02c0246ed43d3b9923a170e8 |
|
MD5 | d79f44554c1589d0c306bfa1d8831101 |
|
BLAKE2b-256 | a8cc9b75600a4c2ae38bf4a756cc13006863160ac81904744ed45e621e7058e9 |