Skip to main content

python cffi bindings for the oniguruma regex engine

Project description

Build Status Azure DevOps coverage

onigurumacffi

python cffi bindings for the oniguruma regex engine

installation

pip install onigurumacffi
  • manylinux 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

_Pattern.match(s: str, start: int = 0) -> 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) -> 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) -> 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-0.0.6.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

onigurumacffi-0.0.6-cp36-abi3-manylinux1_x86_64.whl (528.7 kB view details)

Uploaded CPython 3.6+

File details

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

File metadata

  • Download URL: onigurumacffi-0.0.6.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.9

File hashes

Hashes for onigurumacffi-0.0.6.tar.gz
Algorithm Hash digest
SHA256 69569c860b206d083b931c5206800934f55c8e1915ffe01358ba27e7d7f5e1f8
MD5 3899dde601e07d52465ba974e5e8262e
BLAKE2b-256 c2eb00a1a5f0b4b3826f1129aa8f24cfa5047cc0e8db122cf3822fa5afac9179

See more details on using hashes here.

File details

Details for the file onigurumacffi-0.0.6-cp36-abi3-manylinux1_x86_64.whl.

File metadata

  • Download URL: onigurumacffi-0.0.6-cp36-abi3-manylinux1_x86_64.whl
  • Upload date:
  • Size: 528.7 kB
  • Tags: CPython 3.6+
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.9

File hashes

Hashes for onigurumacffi-0.0.6-cp36-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 af6b5008f7d90c60dea5a687cd945e87c15dc167b0f3bde58f344c7edd626ddf
MD5 f9ae829996f59c87afb84a9984c11f55
BLAKE2b-256 5434262ab2d1d8d3e1cb1bbb32fd58e5849f4281052715df9ff2d2c7c8498347

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 Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page