{"id":16538701,"url":"https://github.com/spyoungtech/regexrs","last_synced_at":"2026-03-09T13:01:48.416Z","repository":{"id":234568493,"uuid":"789156550","full_name":"spyoungtech/regexrs","owner":"spyoungtech","description":"Rust regex + PyO3","archived":false,"fork":false,"pushed_at":"2026-01-19T20:40:40.000Z","size":104,"stargazers_count":1,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-20T02:24:53.144Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spyoungtech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-04-19T20:15:58.000Z","updated_at":"2024-12-29T12:42:40.000Z","dependencies_parsed_at":"2025-02-03T23:27:16.559Z","dependency_job_id":"7b6630fb-5683-4c20-865f-6295b4a40007","html_url":"https://github.com/spyoungtech/regexrs","commit_stats":null,"previous_names":["spyoungtech/regexrs"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/spyoungtech/regexrs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spyoungtech%2Fregexrs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spyoungtech%2Fregexrs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spyoungtech%2Fregexrs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spyoungtech%2Fregexrs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spyoungtech","download_url":"https://codeload.github.com/spyoungtech/regexrs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spyoungtech%2Fregexrs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30297111,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T11:12:22.024Z","status":"ssl_error","status_checked_at":"2026-03-09T11:10:54.577Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T18:46:28.227Z","updated_at":"2026-03-09T13:01:48.376Z","avatar_url":"https://github.com/spyoungtech.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# regex-rust (regexrs)\n\nLeverages the Rust [`regex` crate](https://crates.io/crates/regex) with PyO3 to create an interface similar to the Python\nstandard library `re` module.\n\n```bash\npip install regex-rust\n```\n\n```python\n\u003e\u003e\u003e import regexrs as re\n\u003e\u003e\u003e pattern = re.compile(r'(\\w+) (\\w+)')\n\u003e\u003e\u003e m = pattern.match('hello rust')\n\u003e\u003e\u003e m.groups()\n('hello', 'rust')\n\u003e\u003e\u003e m.pos\n0\n\u003e\u003e\u003e m.endpos\n10\n\u003e\u003e\u003e re.findall(r'\\w+', 'hello rust')\n['hello', 'rust']\n\u003e\u003e\u003e re.fullmatch(r'\\w+', 'foo')\n\u003cregexrs.Match object; span=(0, 3), match=\"foo\"\u003e\n```\n\n## Benchmarks\n\n`benchmark.py` is largely borrowed from the [regex-benchmark](https://github.com/mariomka/regex-benchmark) project. You are expected to pass in a path to the file of the [input-text.txt file](https://github.com/mariomka/regex-benchmark/blob/master/input-text.txt) to `benchmark.py`.\n\nThis simple benchmark suggests that `regexrs` may be significantly faster than the `re` module from the standard library or even the [regex](https://pypi.org/project/regex/) library, at least in some use cases.\nKeep in mind that this benchmark tests just three simple use cases on a single large text input. Therefore, the insights we can infer from this benchmark are quite limited.\nIn some cases, `regexrs` may be up to 2x _slower_ than `regex`, especially when creation of `Match` objects is necessary.\n\nResults as tested on Windows AMD64 Python 3.12.2 - times in ms (lower is better):\n\n| test  | regexrs   | re (stdlib) | [regex](https://pypi.org/project/regex/) | Compared to re    |\n|-------|-----------|-------------|------------------------------------------|-------------------|\n| Email | 12.51     | 354.53      | 690.15                                   | **28.34x faster** |\n| URI   | 4.82      | 282.69      | 430.26                                   | **58.65x faster** |\n| IP    | 4.71      | 321.37      | 25.43                                    | **68.23x faster** |\n\nTo run the benchmarks yourself:\n\n```bash\n# be sure to have run `pip install regex-rust` first\n# to test regexrs:\npython benchmark.py /path/to/input-text.txt\n\n# to test stdlib re:\npython benchmark.py /path/to/input-text.txt re\n\n# be sure to have run `pip install regex` first\n# to test regex library:\npython benchmark.py /path/to/input-text.txt regex\n```\n\n## How to install from source\n\nYou can use `pip` to build and install.\n\n```bash\npip install .\n```\n\nIf you want to build manually:\n\n```bash\npip install maturin\nmaturin build --release\n```\n\n## Status\n\nMostly incomplete and likely very buggy. I am using this mostly as an exercise in creating and distributing Python extensions using Rust and PyO3.\nIt's unclear if this will ever be a particularly useful project or not. If you're looking for a complete and performant\nregex library for Python today, see the [regex project on PyPI](https://pypi.org/project/regex/).\n\n\nDifferences compared to standard lib:\n\n- The `endpos` argument normally found in the `re` module is not supported in `regexrs` for the `match`/`search`/`findall`/`finditer` methods.\n- Some regex features are not supported (because they are not supported by the `regex` crate), such as lookarounds and backreferences.\n- Not all flags are supported. At present release, you may use the flags `IGNORECASE`, `MULTILINE`, `DOTALL` and `VERBOSE` (or their shorthand equivalents). These are translated to inline flags and prepended to your given pattern.\n- Until a future release, there is no cache for avoiding re-compiling the same patterns multiple times\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspyoungtech%2Fregexrs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspyoungtech%2Fregexrs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspyoungtech%2Fregexrs/lists"}