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.17-pp36-pypy36_pp73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 936fcaeb78fa84bfb220096902c025ed10c6bc6686b1e575119634ff74403810 |
|
MD5 | 49565663cc583f0a5dcc63943e85edf4 |
|
BLAKE2b-256 | 615b039e5030917f371b21e4fc23a7f782e901674510ec7e777fcf24e706f55f |
Hashes for onigurumacffi-0.0.17-pp36-pypy36_pp73-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 035f4e922f2074d5152eebe8c506120d49e61d6b92c78035dbebb74f4505747d |
|
MD5 | bea6138342206af900fda07e97467fd8 |
|
BLAKE2b-256 | e68e63c3e8acbe54377303f28eb66c1edbcd63bf559e2ac2aedfae320d9ff30f |
Hashes for onigurumacffi-0.0.17-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f5fb4216f632e727fcab1ae5ff9708122422729853baddc1db89d6a8b7ecec1 |
|
MD5 | 03a4e8a75e39357f2e522dfc6bd20b26 |
|
BLAKE2b-256 | b8dab3834ece447c84e9d59c85e12fd57e7f6e8e79a474e6bf12491f25bbd2e3 |
Hashes for onigurumacffi-0.0.17-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75cf0ea5e4441e52abe96e3926079bcc3eece1886b783e7b5b38796a69c5dd60 |
|
MD5 | de01e07c56f09d45dbc20599e177854c |
|
BLAKE2b-256 | 1d4673c4b25d87681ac7c4d822c20f01523525953d226bd78e10b8504d9e6af8 |
Hashes for onigurumacffi-0.0.17-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e975dcbfa425205bc0d9bef8facdcc0659ff70be344d2ce3fd8421e97c6c96e |
|
MD5 | 8966f5807656bab0dad2ccf04e528172 |
|
BLAKE2b-256 | 1a83be92467a4441189091f76daf51188a55bd318dbe93db655d2bb5c262dd67 |
Hashes for onigurumacffi-0.0.17-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61deac0ef14a8f3480a0a986662642f3970eeb07acc94b12a3b85bdabaa43484 |
|
MD5 | d5a1fa97acdfebad0f2199583cec5586 |
|
BLAKE2b-256 | 4efb118cd12c7fb74cb56b8be3df4f101cc29f59fcc2734399a47f5ca0347f1b |
Hashes for onigurumacffi-0.0.17-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b18929701cb0246c7059d55c99e3b283dd6d688d74ae9c60fa612ed50014ab4 |
|
MD5 | 91d36cb8c1f607a30889fe2c1bb4a9b9 |
|
BLAKE2b-256 | 9a84a84175f53e35f035b4e8995de78c64ed9586698ef62d268fb2222b914aab |
Hashes for onigurumacffi-0.0.17-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99598eba01dfcf7a7cd12798ff917b61d71e0c081b686221ad665ee88874ab00 |
|
MD5 | 3c74a3baf8ab471240b51d5d29f799ad |
|
BLAKE2b-256 | 7db2cc6ce5af147b31c6a1fa18f725add2892979c274676cc907fb27619419d9 |
Hashes for onigurumacffi-0.0.17-cp36-abi3-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2dd4e05add9e2e3d7f14460a14cd8d6c68d3ae150c9a1b7272e0649c541fd272 |
|
MD5 | d996df90069e584a5c4c16c8c6a658d1 |
|
BLAKE2b-256 | f5b04285ba8672cda4f569b6adf8f57d7ec84ae74cd913999d0c456aa7e3fb59 |
Hashes for onigurumacffi-0.0.17-cp36-abi3-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54a87a281d3a624692b8d2e6e8a0196fc21cfd395a3d73bfcc3f1c2e4b5ecd95 |
|
MD5 | b558f2f6407d78d30d4a3f1e2174ea39 |
|
BLAKE2b-256 | b045ce1a8648e3d8f969b63aed5a4f645969013a381457b2c5dfe43657aaa5b9 |