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.5.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

onigurumacffi-1.5.0-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (585.1 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

onigurumacffi-1.5.0-cp310-abi3-win_amd64.whl (193.4 kB view details)

Uploaded CPython 3.10+Windows x86-64

onigurumacffi-1.5.0-cp310-abi3-win32.whl (178.8 kB view details)

Uploaded CPython 3.10+Windows x86

onigurumacffi-1.5.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (605.6 kB view details)

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

onigurumacffi-1.5.0-cp310-abi3-macosx_15_0_x86_64.whl (236.0 kB view details)

Uploaded CPython 3.10+macOS 15.0+ x86-64

onigurumacffi-1.5.0-cp310-abi3-macosx_15_0_arm64.whl (224.8 kB view details)

Uploaded CPython 3.10+macOS 15.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for onigurumacffi-1.5.0.tar.gz
Algorithm Hash digest
SHA256 d4fa9bee44a6d38a98b2237c67d9acdf27ed0c32d6c218125fe46681a5edea4d
MD5 4325db792cbb884b92d3a3ad4d5dba74
BLAKE2b-256 b5e9fab7102ca135470374f81e74e9944c9f58f2bae905df2c045ac0f30838fd

See more details on using hashes here.

File details

Details for the file onigurumacffi-1.5.0-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for onigurumacffi-1.5.0-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a1f39d9edccc63010ee7667b6e8c029e856031adfac3f0581efe4cb71a1083ff
MD5 59d1b5b9502f71743e11dd1ebe3b88d2
BLAKE2b-256 301be801d3a6ebf5adec84ec8f6df19944177e42635174a28164f20157f4ad6b

See more details on using hashes here.

File details

Details for the file onigurumacffi-1.5.0-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for onigurumacffi-1.5.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 862795245ac165913f146e81d18e5419c91f98f50a5eccba02e1ba6d781e8e26
MD5 954071854feb88f02d0cdc4610174e00
BLAKE2b-256 a3676461766dc7e7baea1b02df2c081ac7efcde3edf9cb74a80f570a7dc0566b

See more details on using hashes here.

File details

Details for the file onigurumacffi-1.5.0-cp310-abi3-win32.whl.

File metadata

  • Download URL: onigurumacffi-1.5.0-cp310-abi3-win32.whl
  • Upload date:
  • Size: 178.8 kB
  • Tags: CPython 3.10+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for onigurumacffi-1.5.0-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 995a3a0d932df3995f6e9b081c4c5881ed6bc19c53d9c24d64a51eb21f46989c
MD5 65d5b8822d3636fcfdbfd00f6929d90e
BLAKE2b-256 e27cfda92bcc28c6ef05d6ce4cfd0f85e7a70e6fa9ea3a23fb7fe1b4cf6ef092

See more details on using hashes here.

File details

Details for the file onigurumacffi-1.5.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for onigurumacffi-1.5.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 d2e195b0255f88616af19021ebd6344a00d5a0df01a78c8c43729cf0b9c9fb9c
MD5 22f377c33cd1dd6af5fd88d81e0938db
BLAKE2b-256 2116df7857783279384c910ac6c5272699a226fcec9dc8969b4fe230069d2f99

See more details on using hashes here.

File details

Details for the file onigurumacffi-1.5.0-cp310-abi3-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for onigurumacffi-1.5.0-cp310-abi3-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 3aabcd932605f0a385c612ff22daa97acfa57e78add53bb4a173f281a3b9cf1f
MD5 e674c2fadae285f3ba74dab911ab40c6
BLAKE2b-256 e0c1e211c1f803c4b1315a8e2b017c7257ce5a7b11543ad63f3b7d19696c845f

See more details on using hashes here.

File details

Details for the file onigurumacffi-1.5.0-cp310-abi3-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for onigurumacffi-1.5.0-cp310-abi3-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 6dda67bcbfe5ec8f819506befaa8542f7bc4dd89304dfae31810bf4f15dc2205
MD5 f4e18afcd8db7414aefadd61dd391f63
BLAKE2b-256 8bf92717b5a52032b74e0f53022941baf24dc50ecc99fb31da5621b88882ce64

See more details on using hashes here.

Supported by

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