Skip to main content

python cffi bindings for the oniguruma regex engine

Project description

build status pre-commit.ci status

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onigurumacffi-1.4.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distributions

onigurumacffi-1.4.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (582.5 kB view details)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

onigurumacffi-1.4.1-cp39-abi3-win_amd64.whl (193.2 kB view details)

Uploaded CPython 3.9+ Windows x86-64

onigurumacffi-1.4.1-cp39-abi3-win32.whl (178.8 kB view details)

Uploaded CPython 3.9+ Windows x86

onigurumacffi-1.4.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (603.1 kB view details)

Uploaded CPython 3.9+ manylinux: glibc 2.17+ x86-64

onigurumacffi-1.4.1-cp39-abi3-macosx_14_0_arm64.whl (226.1 kB view details)

Uploaded CPython 3.9+ macOS 14.0+ ARM64

onigurumacffi-1.4.1-cp39-abi3-macosx_13_0_x86_64.whl (238.0 kB view details)

Uploaded CPython 3.9+ macOS 13.0+ x86-64

File details

Details for the file onigurumacffi-1.4.1.tar.gz.

File metadata

  • Download URL: onigurumacffi-1.4.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for onigurumacffi-1.4.1.tar.gz
Algorithm Hash digest
SHA256 5bfbc1ef6e5d1179e22453f82437a824f9d5771e0ce65f3a72ca6b9c61226536
MD5 0c9f4563cee3c178fdf20d25ba3a5f91
BLAKE2b-256 f7fc6bcec22dcf08634364284d533999efb078da6e0de9a965f9ece58c346ad4

See more details on using hashes here.

File details

Details for the file onigurumacffi-1.4.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for onigurumacffi-1.4.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9e8585f593bd136a67ac69330dc778c05227503e6c03e0fa8cb82692c489ae35
MD5 354e2d994d4d7a17b2eea9c6e96a5e7c
BLAKE2b-256 41962cb9dcd453867f2d56fe707f9974289c8e2653cca13815903de18e64a3f6

See more details on using hashes here.

File details

Details for the file onigurumacffi-1.4.1-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for onigurumacffi-1.4.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 949af6f48b6dbdae42b1a4f0121d8904f03904b501bd918b6d18fc7c7ad83836
MD5 5beebb2a77a3748a3d70940ed20b9f5b
BLAKE2b-256 914d247f9df7a57226e488f149206e96943b9d15a076569e659d7df3c123a187

See more details on using hashes here.

File details

Details for the file onigurumacffi-1.4.1-cp39-abi3-win32.whl.

File metadata

  • Download URL: onigurumacffi-1.4.1-cp39-abi3-win32.whl
  • Upload date:
  • Size: 178.8 kB
  • Tags: CPython 3.9+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for onigurumacffi-1.4.1-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 c0fed9bcdaf289a8ecd8343f7b8a4cbabffcc37911be12c8087669edc5ca5a45
MD5 5199658603bc20a62b01569e6c1e8e5c
BLAKE2b-256 33daa797f3df3fcdac893c2f31c764ec7fe79fb786c63ace543675096bbb32ff

See more details on using hashes here.

File details

Details for the file onigurumacffi-1.4.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for onigurumacffi-1.4.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 db36a8297f16e8e52621cb5826289c107e9e8016cf4ca00e0c81dc3d480b90c9
MD5 ea1624659ddc16e805b27564b3ce8cdb
BLAKE2b-256 6a2850922eddf6dff1b8c5dd8ed5b0a8165b1cdcfe366b7a399ef9d7b1cd02ef

See more details on using hashes here.

File details

Details for the file onigurumacffi-1.4.1-cp39-abi3-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for onigurumacffi-1.4.1-cp39-abi3-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 56b583b9d2065fb7d36001d15d7951f5cb3143ff0d8be7daa330a0096db7483a
MD5 8ddec67b7d61fecd1e56cc5974d8a09d
BLAKE2b-256 20e14e90ddcb88baa2a93b6c4c79914fbb453e4f5833556572c629c4cbf19756

See more details on using hashes here.

File details

Details for the file onigurumacffi-1.4.1-cp39-abi3-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for onigurumacffi-1.4.1-cp39-abi3-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 40f587bb4eaabcc0dadfcd6bc56ac2f8db0966e16c90588748410b3e14761715
MD5 73d9a2bb1a482ecb4b059e401faa4892
BLAKE2b-256 16300f51da57b11b787b9a83eef0b152f098cac863b777686d991c263b2bded7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page