{"id":26518750,"url":"https://github.com/mesejo/trrex","last_synced_at":"2025-12-13T21:15:35.103Z","repository":{"id":57477036,"uuid":"253032563","full_name":"mesejo/trrex","owner":"mesejo","description":"Efficient string matching with regular expressions","archived":false,"fork":false,"pushed_at":"2025-09-24T22:40:27.000Z","size":469,"stargazers_count":144,"open_issues_count":3,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-10-04T06:03:56.036Z","etag":null,"topics":["keyword-extraction","nlp","pandas","python","python-library","regex","regular-expression","search-in-text","string-matching","text-mining","trie"],"latest_commit_sha":null,"homepage":"https://trrex.readthedocs.io/en/latest/","language":"Python","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/mesejo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2020-04-04T15:30:43.000Z","updated_at":"2025-09-05T12:40:56.000Z","dependencies_parsed_at":"2024-10-23T22:35:51.394Z","dependency_job_id":"902474b9-f9f7-427a-9996-134ebd9f4f04","html_url":"https://github.com/mesejo/trrex","commit_stats":{"total_commits":65,"total_committers":1,"mean_commits":65.0,"dds":0.0,"last_synced_commit":"2751b4345dd35911a826151f1959304caef2e8a3"},"previous_names":["mesejo/trrex","mesejo/trex"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/mesejo/trrex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mesejo%2Ftrrex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mesejo%2Ftrrex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mesejo%2Ftrrex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mesejo%2Ftrrex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mesejo","download_url":"https://codeload.github.com/mesejo/trrex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mesejo%2Ftrrex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002552,"owners_count":26083403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["keyword-extraction","nlp","pandas","python","python-library","regex","regular-expression","search-in-text","string-matching","text-mining","trie"],"created_at":"2025-03-21T10:02:07.843Z","updated_at":"2025-10-10T02:53:50.822Z","avatar_url":"https://github.com/mesejo.png","language":"Python","readme":"\u003cdiv  align=\"center\"\u003e\n    \u003ca href=\"https://github.com/mesejo/trex\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/mesejo/trex/images/trrex_logo.png\" width=\"150\" height=\"150\" alt=\"trrex logo\"/\u003e\u003c/a\u003e\n\u003c/div\u003e\n\u0026nbsp;\n\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"https://github.com/mesejo/trex\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/mesejo/trex/ci-test.yaml\" alt=\"Trrex\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://pepy.tech/project/trrex\"\u003e\u003cimg src=\"https://pepy.tech/badge/trrex\" alt=\"Downloads\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/trrex\"\u003e\u003cimg src=\"https://img.shields.io/pypi/v/trrex.svg\" alt=\"PyPI Version\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/trrex\"\u003e\u003cimg src=\"https://img.shields.io/pypi/status/trrex.svg\" alt=\"Package Status\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://codecov.io/gh/mesejo/trex\"\u003e\u003cimg src=\"https://codecov.io/gh/mesejo/trex/branch/master/graph/badge.svg\" alt=\"Code Coverage Status\"\u003e\u003c/a\u003e\n     \u003ca href=\"https://trrex.readthedocs.io\"\u003e\u003cimg src=\"https://readthedocs.org/projects/trrex/badge/?version=latest\" alt=\"Documentation Status\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n# Efficient string matching with regular expressions\n\nThis package includes a pure Python function that enables you to represent a set of strings as a regular expression.\nWith this regular expression, you can perform various operations, such as replacing, extracting and matching keywords.\nThe name of the package comes from the internal trie used to build the regular expression (**TR**ie to **RE**ge**X**)\n\n## Install trrex\n\nUse pip,\n\n```bash\npip install trrex\n```\n\n## Usage\n\n```python\nimport trrex as tx\nimport re\n\npattern = tx.make(['baby', 'bat', 'bad'])\nhits = re.findall(pattern, 'The baby was scared by the bad bat.')\n# hits = ['baby', 'bat', 'bad']\n```\n\n### pandas\n\n```python\nimport trrex as tx\nimport pandas as pd\n\nframe = pd.DataFrame({\n    \"txt\": [\"The baby\", \"The bat\"]\n})\npattern = tx.make(['baby', 'bat', 'bad'], prefix=r\"\\b(\", suffix=r\")\\b\") # need to specify capturing groups\nframe[\"match\"] = frame[\"txt\"].str.extract(pattern)\nhits = frame[\"match\"].tolist()\nprint(hits)\n# hits = ['baby', 'bad']\n```\n\n## Why use trrex?\n\n- trrex builds a *better* regex pattern, than the simple regex union, therefore searching (and replacing) strings is\nabout 300 times faster than a regex union pattern, and about 2.5 times faster than FlashText algorithm. See below for a performance\ncomparison:\n\n![Performance comparison](https://github.com/mesejo/trex/blob/images/find_comparison.png?raw=true)\n\n- Plays well with others, can be integrated easily with pandas, spacy and any other regex engine. See the [documentation](https://trrex.readthedocs.io/en/latest/integration.html)\nfor examples.\n- Pure Python, no other dependencies\n\n\n\n\n## Issues\n\nIf you have any issues with this repository, please don't hesitate to [raise them](https://github.com/mesejo/trex/issues/new).\nIt is actively maintained, and we will do our best to help you.\n\n## Acknowledgments\n\nThis project is based on the following resources:\n\n- [Speed up regex](https://stackoverflow.com/questions/42742810/speed-up-millions-of-regex-replacements-in-python-3)\n- [Triegex](https://github.com/ZhukovAlexander/triegex)\n\n## Liked the work?\nIf you've found this repository helpful, why not give it a star? It's an easy way to show your appreciation and support for the project.\nPlus, it helps others discover it too!\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmesejo%2Ftrrex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmesejo%2Ftrrex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmesejo%2Ftrrex/lists"}