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.0.0-pp37-pypy37_pp73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c1469b59f9ef688cd40bb61f4ba733473ebf7b7b96d77c03d6af2da5455ba1b |
|
MD5 | 92ec2e070af41dc752af46bd568ea55a |
|
BLAKE2b-256 | 25e1c7409c4e30ea6f36a39c8cba8ad8700318e93694b11fc8ee576003ff08d1 |
Hashes for onigurumacffi-1.0.0-pp37-pypy37_pp73-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | deec30b0e4a030cba2c834bad66be1a5ca71b312bc953554385f257f160a6e4c |
|
MD5 | 94060521b65e1d415a6aa4aea9e46949 |
|
BLAKE2b-256 | 95e695ce825069b2ae1efea0bca7690732e32ed89e58ba4d8b2bc05860c7da0d |
Hashes for onigurumacffi-1.0.0-pp36-pypy36_pp73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2293d1c5ab7f50ffb6c892d320bfb6b650a87baa11b9ce4081540d4551cd72de |
|
MD5 | 268c06fffefca90de1dcd99d4927958e |
|
BLAKE2b-256 | f3fcfad24687efc39db1e5e846cf9a1a2b94512c5afe29c2f696bafed711973f |
Hashes for onigurumacffi-1.0.0-pp36-pypy36_pp73-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 629b0234eab914b4509266120ef5b68cd4535f21062df01fb097152fbc9b76a0 |
|
MD5 | af50555ad0668e5e756454ce75996f68 |
|
BLAKE2b-256 | 865d2a6574591e159294f065b90cb3e12e09e0474c51da828859029741090c75 |
Hashes for onigurumacffi-1.0.0-cp36-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac91d90cdee1eb3e5b73540093ae9f9b6590be3a2319689426eccc11b83f81be |
|
MD5 | e39b32eed0cce08291fec7d1d4f34903 |
|
BLAKE2b-256 | 9d7479c5cfb188d913ee03a7780a8e1f9124747e9378c2679d363504e9e0aaf3 |
Hashes for onigurumacffi-1.0.0-cp36-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64a5cb71928690e41926f359607a351867c7c236758d7a029cba2d84e99f2b87 |
|
MD5 | 99d14dc53ab515f84952e74d2d80c60e |
|
BLAKE2b-256 | e199c07def07e8521ef57bc0f6654b4bb56e474ee51f2bd26ae1adc9862fb099 |
Hashes for onigurumacffi-1.0.0-cp36-abi3-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 157c97d5a3b3090f0d8551cf8d98797b99ad550bbb6578f3273e62ec00529d6e |
|
MD5 | a761b5dc5c1d38955bc6a59628756759 |
|
BLAKE2b-256 | 5ddaa9afec981f78403937eeba061f2ee79d728dba2761f4db74149333efc8f9 |
Hashes for onigurumacffi-1.0.0-cp36-abi3-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3beca444897857e289ba4abb39984b1f58d4de9e87659cc955f386edc80ad43 |
|
MD5 | e1a8492f58ceb222b8ce0424b77a44ea |
|
BLAKE2b-256 | 25ef14c64a1d7794ec37644921348ac2e15c349a576d257055efd96a6488a5b4 |