[![build status](https://github.com/asottile/onigurumacffi/actions/workflows/main.yml/badge.svg)](https://github.com/asottile/onigurumacffi/actions/workflows/main.yml)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/asottile/onigurumacffi/main.svg)](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": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Anthony Sottile",
"author_email": "asottile@umich.edu",
"download_url": "https://files.pythonhosted.org/packages/37/65/3e968c38ce87c61c8a27c4947c022d3db80d1f8a9fcc61e58e9e49c03822/onigurumacffi-1.3.0.tar.gz",
"platform": null,
"description": "[![build status](https://github.com/asottile/onigurumacffi/actions/workflows/main.yml/badge.svg)](https://github.com/asottile/onigurumacffi/actions/workflows/main.yml)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/asottile/onigurumacffi/main.svg)](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.3.0",
"project_urls": {
"Homepage": "https://github.com/asottile/onigurumacffi"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3de209aacddcd1a0193c2edb509b3d9de60b5db3bfe17e0240d8888f2e4d2f67",
"md5": "82923e980bbf1fa0d43dcab8e1e7c43d",
"sha256": "77d3f174df2195f2af5968170a5286094c30f32f5d80a6c9c7df90fcdd4b545c"
},
"downloads": -1,
"filename": "onigurumacffi-1.3.0-cp38-abi3-macosx_11_0_x86_64.whl",
"has_sig": false,
"md5_digest": "82923e980bbf1fa0d43dcab8e1e7c43d",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 238225,
"upload_time": "2023-10-14T17:08:36",
"upload_time_iso_8601": "2023-10-14T17:08:36.337745Z",
"url": "https://files.pythonhosted.org/packages/3d/e2/09aacddcd1a0193c2edb509b3d9de60b5db3bfe17e0240d8888f2e4d2f67/onigurumacffi-1.3.0-cp38-abi3-macosx_11_0_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9567d79921bc9645d692932d338465427f7486f6f00edd714b5b3aaccf92dd07",
"md5": "64b89cf45c7a9980cc7ca1f83d2cc241",
"sha256": "2fc00956c5e824373f5b59c1714470472f8df162db773166aeae9cc4d80a1245"
},
"downloads": -1,
"filename": "onigurumacffi-1.3.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "64b89cf45c7a9980cc7ca1f83d2cc241",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 599741,
"upload_time": "2023-10-14T17:08:38",
"upload_time_iso_8601": "2023-10-14T17:08:38.833152Z",
"url": "https://files.pythonhosted.org/packages/95/67/d79921bc9645d692932d338465427f7486f6f00edd714b5b3aaccf92dd07/onigurumacffi-1.3.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d5b150515e8e28699cc533b9ef3d5f9b017e2533e93aab3b3cdb16e8d12ff512",
"md5": "687b1b93d4b14c7aab3f8a3e78f144e6",
"sha256": "31a22befe51ce2ce0c56936edeccbbca5f8e63c0808baf8e108e04642edc5091"
},
"downloads": -1,
"filename": "onigurumacffi-1.3.0-cp38-abi3-win32.whl",
"has_sig": false,
"md5_digest": "687b1b93d4b14c7aab3f8a3e78f144e6",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 176126,
"upload_time": "2023-10-14T17:08:40",
"upload_time_iso_8601": "2023-10-14T17:08:40.894634Z",
"url": "https://files.pythonhosted.org/packages/d5/b1/50515e8e28699cc533b9ef3d5f9b017e2533e93aab3b3cdb16e8d12ff512/onigurumacffi-1.3.0-cp38-abi3-win32.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "64be0cf9a7494d0ce25e5c715b05c73e401eb2274c3d65ef34ab7b1238d6bbf0",
"md5": "853a455559bad7214d360efc23bcb60d",
"sha256": "45fcb24ebce96e884c34e5b93e46b371e21a9a4cb85c386a3359a5eacab31575"
},
"downloads": -1,
"filename": "onigurumacffi-1.3.0-cp38-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "853a455559bad7214d360efc23bcb60d",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 191811,
"upload_time": "2023-10-14T17:08:42",
"upload_time_iso_8601": "2023-10-14T17:08:42.780122Z",
"url": "https://files.pythonhosted.org/packages/64/be/0cf9a7494d0ce25e5c715b05c73e401eb2274c3d65ef34ab7b1238d6bbf0/onigurumacffi-1.3.0-cp38-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3bd71fad16190046997419bbc2526e14d9274943eba5454677289dde76527dce",
"md5": "b0fa32d5556275136c4d3fc8c3811c06",
"sha256": "5b2187f4722ffee8b1e7e529d1998c8abb2236da19bafc59bce881c335f53d6e"
},
"downloads": -1,
"filename": "onigurumacffi-1.3.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "b0fa32d5556275136c4d3fc8c3811c06",
"packagetype": "bdist_wheel",
"python_version": "pp310",
"requires_python": ">=3.8",
"size": 579059,
"upload_time": "2023-10-14T17:08:44",
"upload_time_iso_8601": "2023-10-14T17:08:44.609725Z",
"url": "https://files.pythonhosted.org/packages/3b/d7/1fad16190046997419bbc2526e14d9274943eba5454677289dde76527dce/onigurumacffi-1.3.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fff78de1d8874ab681ed4d9d6a132768850b77191e7cc4933895ada86d09407f",
"md5": "48f89c655fa8a58a377d2537373c1beb",
"sha256": "094b22f59bbc12812272686e468e3956a8a34262f3ee79e6ebea60ac12756713"
},
"downloads": -1,
"filename": "onigurumacffi-1.3.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "48f89c655fa8a58a377d2537373c1beb",
"packagetype": "bdist_wheel",
"python_version": "pp38",
"requires_python": ">=3.8",
"size": 579055,
"upload_time": "2023-10-14T17:08:47",
"upload_time_iso_8601": "2023-10-14T17:08:47.390670Z",
"url": "https://files.pythonhosted.org/packages/ff/f7/8de1d8874ab681ed4d9d6a132768850b77191e7cc4933895ada86d09407f/onigurumacffi-1.3.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "018cd249263e4b58b95d480f7c90f19ff271d9a5e14c9b2725136beb7acbec28",
"md5": "ace70596db04666ec328511385147b02",
"sha256": "7c1f34f9f6cd5185a1ed1146ccbf2e9d808b508816a13b6ed8b1550e2a246f79"
},
"downloads": -1,
"filename": "onigurumacffi-1.3.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "ace70596db04666ec328511385147b02",
"packagetype": "bdist_wheel",
"python_version": "pp39",
"requires_python": ">=3.8",
"size": 579056,
"upload_time": "2023-10-14T17:08:48",
"upload_time_iso_8601": "2023-10-14T17:08:48.668771Z",
"url": "https://files.pythonhosted.org/packages/01/8c/d249263e4b58b95d480f7c90f19ff271d9a5e14c9b2725136beb7acbec28/onigurumacffi-1.3.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "37653e968c38ce87c61c8a27c4947c022d3db80d1f8a9fcc61e58e9e49c03822",
"md5": "6a64c010a76139d12ff7a952d7c57e51",
"sha256": "7745cdc56096acec88a1f3b08660a22b09c659ed38d3f59db6c1cad76a976bef"
},
"downloads": -1,
"filename": "onigurumacffi-1.3.0.tar.gz",
"has_sig": false,
"md5_digest": "6a64c010a76139d12ff7a952d7c57e51",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 5521,
"upload_time": "2023-10-14T17:01:08",
"upload_time_iso_8601": "2023-10-14T17:01:08.971988Z",
"url": "https://files.pythonhosted.org/packages/37/65/3e968c38ce87c61c8a27c4947c022d3db80d1f8a9fcc61e58e9e49c03822/onigurumacffi-1.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-14 17:01:08",
"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"
}