{"id":16937618,"url":"https://github.com/megaing/interegular","last_synced_at":"2025-04-09T20:04:56.222Z","repository":{"id":62571233,"uuid":"199148230","full_name":"MegaIng/interegular","owner":"MegaIng","description":"Allows to check regexes for overlaps. Based on greenery by @qntm.","archived":false,"fork":false,"pushed_at":"2024-06-05T13:10:54.000Z","size":111,"stargazers_count":48,"open_issues_count":7,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T20:04:51.050Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/MegaIng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2019-07-27T10:06:41.000Z","updated_at":"2025-03-11T16:53:16.000Z","dependencies_parsed_at":"2024-01-07T00:05:25.761Z","dependency_job_id":null,"html_url":"https://github.com/MegaIng/interegular","commit_stats":null,"previous_names":["megaing/regex_intersections"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegaIng%2Finteregular","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegaIng%2Finteregular/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegaIng%2Finteregular/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MegaIng%2Finteregular/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MegaIng","download_url":"https://codeload.github.com/MegaIng/interegular/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103868,"owners_count":21048245,"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","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-13T20:59:53.256Z","updated_at":"2025-04-09T20:04:56.201Z","avatar_url":"https://github.com/MegaIng.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Interegular\n***regex intersection checker***\n\nA library to check a subset of python regexes for intersections.\nBased on [greenery](https://github.com/qntm/greenery) by [@qntm](https://github.com/qntm). Adapted for [lark-parser](https://github.com/lark-parser/lark).\n\nThe primary difference with `greenery` library is that `interegular` is focused on speed and compatibility with python re syntax, whereas greenery has a way to reconstruct a regex from a FSM, which `interegular` lacks.\n\n\n## Interface\n\n| Function | Usage |\n| -------- | ----- |\n| `compare_regexes(*regexes: str)` | Takes a series of regexes as strings and returns a Generator of all intersections as `(str, str)`|\n| `parse_pattern(regex: str)` | Parses a regex as string to a `Pattern` object|\n| `interegular.compare_patterns(*patterns: Pattern)` | Takes a series of regexes as patterns and returns a Generator of all intersections as `(Pattern, Pattern)`|\n| `Pattern` | A class representing a parsed regex (intermediate representation)|\n| `REFlags` | A enum representing the flags a regex can have |\n| `FSM` | A class representing a fully parsed regex. (Has many useful members) |\n| `Pattern.with_flags(added: REFlags, removed: REFlags)` | A function to change the flags that are applied to a regex|\n| `Pattern.to_fsm() -\u003e FSM` | A function to create a `FSM` object from the Pattern |\n| `Comparator` | A Class to compare a group of Patterns |\n\n## What is supported?\n\nMost normal python-regex syntax is support. But because of the backend that is used (final-state-machines), some things can not be implemented. This includes:\n\n- Backwards references (`\\1`, `(?P=open)`)\n- Conditional Matching (`(?(1)a|b)`)\n- Some cases of lookaheads/lookbacks (You gotta try out which work and which don't)\n  - A word of warning: This is currently not correctly handled, and some things might parse, but not work correctly. I am currently working on this.\n\n\nSome things are simply not implemented and will implemented in the future:\n- Some flags (Progress: `ims` from `aiLmsux`)\n- Some cases of lookaheads/lookbacks (You gotta try out which work and which don't)\n\n\n## TODO\n\n- Docs\n- More tests\n- Checks that the syntax is correctly handled.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmegaing%2Finteregular","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmegaing%2Finteregular","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmegaing%2Finteregular/lists"}