{"id":29907974,"url":"https://github.com/devbm7/rexplain","last_synced_at":"2025-08-14T05:03:58.527Z","repository":{"id":306202597,"uuid":"1024766720","full_name":"devbm7/rexplain","owner":"devbm7","description":"Explain, test and generate examples for regular expressions","archived":false,"fork":false,"pushed_at":"2025-08-01T09:41:44.000Z","size":672,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-01T11:56:40.597Z","etag":null,"topics":["pip","python-package","python3","regex","regex-util"],"latest_commit_sha":null,"homepage":"https://devbm7.github.io/rexplain/","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/devbm7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2025-07-23T08:06:50.000Z","updated_at":"2025-08-01T09:41:25.000Z","dependencies_parsed_at":"2025-07-24T10:18:37.930Z","dependency_job_id":null,"html_url":"https://github.com/devbm7/rexplain","commit_stats":null,"previous_names":["devbm7/rexplain"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/devbm7/rexplain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devbm7%2Frexplain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devbm7%2Frexplain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devbm7%2Frexplain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devbm7%2Frexplain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devbm7","download_url":"https://codeload.github.com/devbm7/rexplain/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devbm7%2Frexplain/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268222947,"owners_count":24215710,"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-08-01T02:00:08.611Z","response_time":67,"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":["pip","python-package","python3","regex","regex-util"],"created_at":"2025-08-01T23:16:32.456Z","updated_at":"2025-08-01T23:16:34.716Z","avatar_url":"https://github.com/devbm7.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rexplain\n\n[![PyPI version](https://img.shields.io/pypi/v/rexplain.svg)](https://pypi.org/project/rexplain/)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/rexplain)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Tests](https://github.com/devbm7/rexplain/workflows/Test/badge.svg)](https://github.com/devbm7/rexplain/actions/workflows/test.yml)\n[![Coverage](https://img.shields.io/badge/coverage-70%25+-brightgreen)](https://github.com/devbm7/rexplain/actions/workflows/test.yml)\n\nExplain, test, and generate examples for regular expressions.\n\n## Overview\n\n**rexplain** is a Python toolkit for understanding, testing, and generating examples for regular expressions. It provides:\n- Human-readable, line-by-line explanations of regex patterns\n- Example string generation for any regex\n- Detailed match testing with feedback\n- Visual railroad diagrams for regex patterns\n- Both a Python API and a CLI\n\n## Features\n- **Regex Explanation:** Get clear, context-aware explanations for any regex pattern\n- **Test Regex:** Test if a string matches a pattern and see why/why not\n- **Generate Examples:** Generate example strings that match a regex\n- **Visual Diagrams:** Generate railroad diagrams to visualize regex patterns\n- **CLI \u0026 API:** Use from the command line or as a Python library\n- **Regex Flags:** Supports Python regex flags (e.g., `re.IGNORECASE`)\n\n## Installation\n\n```bash\npip install rexplain\n```\n\n## Quick Start\n\n### CLI Usage\n\nExplain a regex pattern:\n```bash\nrexplain explain \"^\\d{3}-\\d{2}-\\d{4}$\"\n```\n\nGenerate example strings:\n```bash\nrexplain examples \"[A-Za-z]{5}\" --count 3\n```\n\nTest if a string matches a pattern:\n```bash\nrexplain test \"^hello.*\" \"hello world!\"\n```\n\nGenerate a railroad diagram:\n```bash\nrexplain diagram \"^\\\\w+$\" --output diagram.svg\nrexplain diagram \"^\\\\w+$\" --detailed --output detailed.svg\n```\n\n### Python API Usage\n\n```python\nfrom rexplain import explain, examples, test, diagram\n\nprint(explain(r\"\\d+\"))\nprint(examples(r\"[A-Z]{2}\\d{2}\", count=2))\nprint(test(r\"foo.*\", \"foobar\"))\n\n# Generate diagrams\ndiagram(r\"^\\w+$\", \"simple.svg\")\ndiagram(r\"^\\w+$\", \"detailed.svg\", detailed=True)\nsvg_content = diagram(r\"^\\w+$\")  # Returns SVG as string\n```\n\n#### Example: Detailed Explanation\n```python\nfrom rexplain import explain\nprint(explain(r\"abc\\w+\\w*10$\"))\n# Output:\n# a - matches the character 'a' (ASCII 97) literally (case sensitive)\n# b - matches the character 'b' (ASCII 98) literally (case sensitive)\n# c - matches the character 'c' (ASCII 99) literally (case sensitive)\n# \\w+ - matches a word character one or more times (greedy)\n# \\w* - matches a word character zero or more times (greedy)\n# 1 - matches the character '1' (ASCII 49) literally (case sensitive)\n# 0 - matches the character '0' (ASCII 48) literally (case sensitive)\n# $ - asserts position at the end of a line\n```\n\n## API Reference\n\n### `explain(pattern: str, flags: int = 0) -\u003e str`\nReturns a line-by-line explanation of the regex pattern.\n\n### `examples(pattern: str, count: int = 3, flags: int = 0) -\u003e List[str]`\nGenerates example strings that match the pattern.\n\n### `test(pattern: str, test_string: str, flags: int = 0) -\u003e dict`\nTests if a string matches the pattern and explains why/why not.\n\n### `diagram(pattern: str, output_path: str = None, detailed: bool = False) -\u003e str`\nGenerates a railroad diagram for the regex pattern. Returns SVG content or saves to file.\n\n## Contributing\n\nContributions are welcome! To contribute:\n- Fork the repo and create a branch\n- Add or improve features/tests/docs\n- Run tests\n- Open a pull request\n\n## Running Tests \u0026 Coverage\n\nTo run all tests with coverage (threshold: 70%):\n\n```bash\npip install .[test]\npytest\n```\n\nIf coverage is below 70%, pytest will fail. Coverage details will be shown in the terminal.\n\n### Test Coverage Details\n- **Required Threshold**: 70%\n- **Covered Modules**: All core functionality with comprehensive test coverage\n- **Missing Coverage**: Mainly CLI interface and some edge cases in diagram generation\n- **Live Status**: Check the [GitHub Actions](https://github.com/devbm7/rexplain/actions/workflows/test.yml) for current coverage reports\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevbm7%2Frexplain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevbm7%2Frexplain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevbm7%2Frexplain/lists"}