[](https://github.com/asottile/onigurumacffi/actions/workflows/main.yml)
[](https://results.pre-commit.ci/latest/github/asottile/onigurumacffi/main)
onigurumacffi
=============
python cffi bindings for the oniguruma regex engine
### installation
```bash
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:
```python
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
Raw data
{
"_id": null,
"home_page": "https://github.com/asottile/onigurumacffi",
"name": "onigurumacffi",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Anthony Sottile",
"author_email": "asottile@umich.edu",
"download_url": "https://files.pythonhosted.org/packages/f7/fc/6bcec22dcf08634364284d533999efb078da6e0de9a965f9ece58c346ad4/onigurumacffi-1.4.1.tar.gz",
"platform": null,
"description": "[](https://github.com/asottile/onigurumacffi/actions/workflows/main.yml)\n[](https://results.pre-commit.ci/latest/github/asottile/onigurumacffi/main)\n\nonigurumacffi\n=============\n\npython cffi bindings for the oniguruma regex engine\n\n### installation\n\n```bash\npip install onigurumacffi\n```\n\n- wheels should be available on pypi in most cases\n- to build from source, `libonig-dev` must be installed prior to installation\n\n### api\n\nthe api is currently *very limited* (basically just enough to support what I\nneeded).\n\n#### `compile(pattern: str) -> _Pattern`\n\nmake a compiled pattern\n\n#### `compile_regset(*patterns: str) -> _RegSet`\n\nmake a compiled RegSet\n\n#### `OnigSearchOption`\n\nan enum listing the search-time options for oniguruma\n\nthe current set of options are:\n\n```python\nclass OnigSearchOption(enum.IntEnum):\n NONE = ...\n NOTBOL = ...\n NOTEOL = ...\n POSIX_REGION = ...\n CHECK_VALIDITY_OF_STRING = ...\n NOT_BEGIN_STRING = ...\n NOT_BEGIN_POSITION = ...\n```\n\n#### `_Pattern.match(s: str, start: int = 0, flags: OnigSearchOption = OnigSearchOption.NONE) -> Optional[_Match]`\n\nmatch a string using the pattern. optionally set `start` to adjust the offset\nwhich is searched from\n\n#### `_Pattern.search(s: str, start: int = 0, flags: OnigSearchOption = OnigSearchOption.NONE) -> Optional[_Match]`\n\nsearch a string using the pattern. optionally set `start` to adjust the offset\nwhich is searched from\n\n#### `_Pattern.number_of_captures() -> int`\n\nreturn the number of captures in the regex\n\n#### `_RegSet.search(s: str, start: int = 0, flags: OnigSearchOption = OnigSearchOption.NONE) -> Tuple[int, Optional[_Match]]`\n\nsearch a string using the RegSet. optionally set `start` to adjust the offset\nwhich is searched from\n\nthe leftmost regex index and match is returned or `(-1, None)` if there is no\nmatch\n\n#### `_Match.group(n: int = 0) -> str`\n\nreturn the string of the matched group, defaults to 0 (the whole match)\n\n#### `_Match[n: int] -> str`\n\na shorthand alias for `_Match.group(...)`\n\n#### `_Match.start(n: int = 0) -> int`\n\nreturn the character position of the start of the matched group, defaults to 0\n(the whole match)\n\n#### `_Match.end(n: int = 0) -> int`\n\nreturn the character position of the end of the matched group, defaults to 0\n(the whole match)\n\n#### `_Match.span(n: int = 0) -> int`\n\nreturn `(start, end)` character position of the matched group, defaults to 0\n(the whole match)\n\n#### `_Match.expand(s: str) -> str`\n\nexpand numeric groups in `s` via the groups in the match\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "python cffi bindings for the oniguruma regex engine",
"version": "1.4.1",
"project_urls": {
"Homepage": "https://github.com/asottile/onigurumacffi"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "16300f51da57b11b787b9a83eef0b152f098cac863b777686d991c263b2bded7",
"md5": "73d9a2bb1a482ecb4b059e401faa4892",
"sha256": "40f587bb4eaabcc0dadfcd6bc56ac2f8db0966e16c90588748410b3e14761715"
},
"downloads": -1,
"filename": "onigurumacffi-1.4.1-cp39-abi3-macosx_13_0_x86_64.whl",
"has_sig": false,
"md5_digest": "73d9a2bb1a482ecb4b059e401faa4892",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 238030,
"upload_time": "2025-01-04T19:29:18",
"upload_time_iso_8601": "2025-01-04T19:29:18.047733Z",
"url": "https://files.pythonhosted.org/packages/16/30/0f51da57b11b787b9a83eef0b152f098cac863b777686d991c263b2bded7/onigurumacffi-1.4.1-cp39-abi3-macosx_13_0_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "20e14e90ddcb88baa2a93b6c4c79914fbb453e4f5833556572c629c4cbf19756",
"md5": "8ddec67b7d61fecd1e56cc5974d8a09d",
"sha256": "56b583b9d2065fb7d36001d15d7951f5cb3143ff0d8be7daa330a0096db7483a"
},
"downloads": -1,
"filename": "onigurumacffi-1.4.1-cp39-abi3-macosx_14_0_arm64.whl",
"has_sig": false,
"md5_digest": "8ddec67b7d61fecd1e56cc5974d8a09d",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 226097,
"upload_time": "2025-01-04T19:29:19",
"upload_time_iso_8601": "2025-01-04T19:29:19.238489Z",
"url": "https://files.pythonhosted.org/packages/20/e1/4e90ddcb88baa2a93b6c4c79914fbb453e4f5833556572c629c4cbf19756/onigurumacffi-1.4.1-cp39-abi3-macosx_14_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6a2850922eddf6dff1b8c5dd8ed5b0a8165b1cdcfe366b7a399ef9d7b1cd02ef",
"md5": "ea1624659ddc16e805b27564b3ce8cdb",
"sha256": "db36a8297f16e8e52621cb5826289c107e9e8016cf4ca00e0c81dc3d480b90c9"
},
"downloads": -1,
"filename": "onigurumacffi-1.4.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "ea1624659ddc16e805b27564b3ce8cdb",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 603072,
"upload_time": "2025-01-04T19:18:20",
"upload_time_iso_8601": "2025-01-04T19:18:20.152502Z",
"url": "https://files.pythonhosted.org/packages/6a/28/50922eddf6dff1b8c5dd8ed5b0a8165b1cdcfe366b7a399ef9d7b1cd02ef/onigurumacffi-1.4.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "33daa797f3df3fcdac893c2f31c764ec7fe79fb786c63ace543675096bbb32ff",
"md5": "5199658603bc20a62b01569e6c1e8e5c",
"sha256": "c0fed9bcdaf289a8ecd8343f7b8a4cbabffcc37911be12c8087669edc5ca5a45"
},
"downloads": -1,
"filename": "onigurumacffi-1.4.1-cp39-abi3-win32.whl",
"has_sig": false,
"md5_digest": "5199658603bc20a62b01569e6c1e8e5c",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 178757,
"upload_time": "2025-01-04T19:29:20",
"upload_time_iso_8601": "2025-01-04T19:29:20.459000Z",
"url": "https://files.pythonhosted.org/packages/33/da/a797f3df3fcdac893c2f31c764ec7fe79fb786c63ace543675096bbb32ff/onigurumacffi-1.4.1-cp39-abi3-win32.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "914d247f9df7a57226e488f149206e96943b9d15a076569e659d7df3c123a187",
"md5": "5beebb2a77a3748a3d70940ed20b9f5b",
"sha256": "949af6f48b6dbdae42b1a4f0121d8904f03904b501bd918b6d18fc7c7ad83836"
},
"downloads": -1,
"filename": "onigurumacffi-1.4.1-cp39-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "5beebb2a77a3748a3d70940ed20b9f5b",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 193233,
"upload_time": "2025-01-04T19:29:24",
"upload_time_iso_8601": "2025-01-04T19:29:24.563435Z",
"url": "https://files.pythonhosted.org/packages/91/4d/247f9df7a57226e488f149206e96943b9d15a076569e659d7df3c123a187/onigurumacffi-1.4.1-cp39-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "41962cb9dcd453867f2d56fe707f9974289c8e2653cca13815903de18e64a3f6",
"md5": "354e2d994d4d7a17b2eea9c6e96a5e7c",
"sha256": "9e8585f593bd136a67ac69330dc778c05227503e6c03e0fa8cb82692c489ae35"
},
"downloads": -1,
"filename": "onigurumacffi-1.4.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "354e2d994d4d7a17b2eea9c6e96a5e7c",
"packagetype": "bdist_wheel",
"python_version": "pp310",
"requires_python": ">=3.9",
"size": 582540,
"upload_time": "2025-01-04T19:18:22",
"upload_time_iso_8601": "2025-01-04T19:18:22.680410Z",
"url": "https://files.pythonhosted.org/packages/41/96/2cb9dcd453867f2d56fe707f9974289c8e2653cca13815903de18e64a3f6/onigurumacffi-1.4.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f7fc6bcec22dcf08634364284d533999efb078da6e0de9a965f9ece58c346ad4",
"md5": "0c9f4563cee3c178fdf20d25ba3a5f91",
"sha256": "5bfbc1ef6e5d1179e22453f82437a824f9d5771e0ce65f3a72ca6b9c61226536"
},
"downloads": -1,
"filename": "onigurumacffi-1.4.1.tar.gz",
"has_sig": false,
"md5_digest": "0c9f4563cee3c178fdf20d25ba3a5f91",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 5527,
"upload_time": "2025-01-04T19:17:03",
"upload_time_iso_8601": "2025-01-04T19:17:03.885193Z",
"url": "https://files.pythonhosted.org/packages/f7/fc/6bcec22dcf08634364284d533999efb078da6e0de9a965f9ece58c346ad4/onigurumacffi-1.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-04 19:17:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "asottile",
"github_project": "onigurumacffi",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "onigurumacffi"
}