{"id":49741593,"url":"https://github.com/luciferreeves/edify","last_synced_at":"2026-05-09T19:28:16.640Z","repository":{"id":58267958,"uuid":"530849208","full_name":"luciferreeves/edify","owner":"luciferreeves","description":"Regular Expressions Made Simple.","archived":false,"fork":false,"pushed_at":"2026-04-28T08:58:44.000Z","size":1869,"stargazers_count":105,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-04-28T09:16:47.536Z","etag":null,"topics":["edify","matching","pattern-builder","python","regex","regex-builder","regex-library","regexp","utility-library","verification"],"latest_commit_sha":null,"homepage":"http://edify.rtfd.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luciferreeves.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-30T22:12:43.000Z","updated_at":"2026-04-28T08:58:48.000Z","dependencies_parsed_at":"2023-01-30T14:00:25.442Z","dependency_job_id":null,"html_url":"https://github.com/luciferreeves/edify","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/luciferreeves/edify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luciferreeves%2Fedify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luciferreeves%2Fedify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luciferreeves%2Fedify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luciferreeves%2Fedify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luciferreeves","download_url":"https://codeload.github.com/luciferreeves/edify/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luciferreeves%2Fedify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32832482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"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":["edify","matching","pattern-builder","python","regex","regex-builder","regex-library","regexp","utility-library","verification"],"created_at":"2026-05-09T19:28:15.911Z","updated_at":"2026-05-09T19:28:16.627Z","avatar_url":"https://github.com/luciferreeves.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"========\nEdify\n========\n\n.. Cover Image\n.. image:: https://raw.githubusercontent.com/luciferreeves/edify/main/images/cover.png\n    :alt: Cover Image\n\n|\n\n.. image:: https://readthedocs.org/projects/edify/badge/?style=flat\u0026version=latest\n    :target: https://edify.readthedocs.io/\n    :alt: Documentation Status\n\n.. image:: https://github.com/luciferreeves/edify/actions/workflows/github-actions.yml/badge.svg?branch=main\n    :alt: GitHub Actions Build Status\n    :target: https://github.com/luciferreeves/edify/actions\n\n.. image:: https://codecov.io/gh/luciferreeves/edify/branch/main/graphs/badge.svg?branch=main\n    :alt: Coverage Status\n    :target: https://codecov.io/github/luciferreeves/edify\n\n.. image:: https://img.shields.io/pypi/v/edify.svg\n    :alt: PyPI Package latest release\n    :target: https://pypi.org/project/edify\n\n.. image:: https://img.shields.io/pypi/wheel/edify.svg\n    :alt: PyPI Wheel\n    :target: https://pypi.org/project/edify\n\n.. image:: https://img.shields.io/pypi/pyversions/edify.svg\n    :alt: Supported versions\n    :target: https://pypi.org/project/edify\n\n.. image:: https://img.shields.io/pypi/implementation/edify.svg\n    :alt: Supported implementations\n    :target: https://pypi.org/project/edify\n\n.. image:: https://img.shields.io/github/commits-since/luciferreeves/edify/v0.3.0.svg\n    :alt: Commits since latest release\n    :target: https://github.com/luciferreeves/edify/compare/v0.3.0...main\n\n\n\n.. end-badges\n\n|\n\nEdify (/ˈɛdɪfaɪ/, \"ed-uh-fahy\") is a Python library that allows you to easily create regular expressions for matching text in a programmatically-friendly way. It is designed to be used in conjunction with the ``re`` module.\n\nIt also allows you to verify a string quickly by providing commonly used regex patterns in its extensive set of built-in patterns. To tap into a pattern, simply import the pattern function from the ``edify.library`` module.\n\nQuick Start\n=============\n\nTo get started make sure you have Python 3.8-3.14 installed and then, install Edify from ``pip``:\n\n.. code-block:: bash\n\n    pip install edify\n\nYou can also install the in-development version with:\n\n.. code-block:: bash\n\n    pip install https://github.com/luciferreeves/edify/archive/main.zip\n\nThen go on to import the ``RegexBuilder`` class from the ``edify`` module.\n\nUsing Pre-Built Patterns\n------------------------\n\nThe following example recognises and captures any email like ``email@example.com``.\n\n.. code-block:: python\n\n\n    from edify.library import email\n\n    email_addr = \"email@example.com\"\n    assert email(email_addr) == True\n\n\nBuilding Regex Example: Validating 16-bit Hexadecimal Number\n------------------------------------------------------------\n\nThe following example recognises and captures the value of a 16-bit hexadecimal number like ``0xC0D3``.\n\n.. code-block:: python\n\n\n    from edify import RegexBuilder\n\n    expr = (\n        RegexBuilder()\n        .start_of_input()\n        .optional().string(\"0x\")                # match an optional \"0x\" string\n        .capture()\n            .exactly(4).any_of()                # let x = any characters between (a-f, A-F, and 0-9)\n                .range(\"A\", \"F\")                # now capture exactly 4 such groups of \"x\"\n                .range(\"a\", \"f\")                # this will give the match for the number like \"C0D3\"\n                .range(\"0\", \"9\")                # which when combined with \"0x\" becomes a 16-bit hexadecimal number\n            .end()\n        .end()\n        .end_of_input()\n        .to_regex()                             # used to convert to `re` compatible form\n    )\n\n    \"\"\"\n    Produces the following regular expression:\n    re.compile(^(?:0x)?([A-Fa-f0-9]{4})$)\n\n    Using `to_regex_string()` instead of `to_regex()` at the end\n    will give the compiled regex string.\n    \"\"\"\n\n    assert expr.match(\"0xC0D3\")\n\nBuilding Regex Example: Validating Signed Integer\n-------------------------------------------------\n\nThe following example recognises and checks if a number is a valid signed integer or not (eg. ``-45`` or ``+45``).\n\n.. code-block:: python\n\n\n    from edify import RegexBuilder\n\n    # expression for matching any signed integer. compiles to '^[\\+\\-]{1}\\d+$'\n    expr = (\n        RegexBuilder()\n            .start_of_input()\n                .exactly(1).any_of()            # capture either '+' or '-', exactly once\n                    .char('+')\n                    .char('-')\n                .end()\n                .one_or_more().digit()          # capture any number of digits\n            .end_of_input()\n        .to_regex()\n    )\n\n    if expr.match('-69'):\n        print(\"Matched\")                        # prints matched\n\nBuilding Regex Example: Simple URL Validator\n--------------------------------------------\n\nThe following example checks if a string is a valid url in the form of ``https://www.example.com/path/to/file.ext``\n\n\n.. code-block:: python\n\n\n    from edify import RegexBuilder\n\n    # expression for validating URLs\n    validate_urls = (\n        RegexBuilder()\n            .optional().string('http://')       # look for an optional \"http://\"\n            .optional().string('https://')      # or \"https://\"\n            .one_or_more().any_of()             # let x = any characters between (a-z, 0-9, '-', and '.')\n                .range('a', 'z')                # now capture one or more groups of \"x\"\n                .range('0', '9')                # essentially capturing all url patterns in the form of\n                .any_of_chars('.-')             # xxx.yyyyyyy.abra-cadabra.com\n            .end()\n            .at_least(2).any_of()               # this is to make sure we get at least 2 characters in\n                .range('a', 'z')                # the end of the string, which would be our domain\n            .end()\n            .zero_or_more().any_of()\n                .range('a', 'z')                # same logic as capturing the url in step 1, but now\n                .range('0', '9')                # we are essentially looking for an optional path\n                .any_of_chars('/.-_%')          # and we add some more characters supported in path\n            .end()\n        )\n\n    # compiles to '^(?:http://)?(?:https://)?([a-z0-9\\\\.]+[a-z]{2,}[a-z0-9/\\\\.\\\\-_%]*)$'\n    expr = (\n        RegexBuilder()\n            .ignore_case()                      # case does not matter\n            .subexpression(validate_urls)       # directly writing the subexpression works too\n        .to_regex()                             # convert to regex finally\n    )\n\n\n    if expr.match('https://SOMETHING.www.exam-ple.com/path/to/file.txt'):\n        print(\"Matched\")                        # prints matched\n\n\nBuilding Regex Example: Simple Password Validator\n-------------------------------------------------\nThe regular expression below cheks that a password:\n\n* Has minimum 8 characters in length.\n* At least one uppercase English letter.\n* At least one lowercase English letter.\n* At least one digit.\n* At least one special character from ``#?!@$%^\u0026*-``.\n\n.. code-block:: python\n\n    from edify import RegexBuilder\n\n    # expression for validating passwords - complies to '^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^\u0026*-]).{8,}$'\n    expr = (\n        RegexBuilder()\n            .start_of_input()   # asserts position at start of a line\n                .assert_ahead() # positive look ahead\n                    # matches any character in range 'A' to 'Z' zero and unlimited times,\n                    # as few times as possible, expanding as needed (lazy) - matching at least 1 uppercase character\n                    .zero_or_more_lazy().any_char().range('A', 'Z')\n                .end()\n                .assert_ahead()\n                     # at least 1 lowercase character\n                    .zero_or_more_lazy().any_char().range('a', 'z')\n                .end()\n                .assert_ahead()\n                    # at least 1 number\n                    .zero_or_more_lazy().any_char().range('0', '9')\n                .end()\n                .assert_ahead()\n                    # at least 1 special character present in the list\n                    .zero_or_more_lazy().any_char().any_of_chars('#?!@$%^\u0026*-')\n                .end()\n                .at_least(8).any_char() # must be at least 8 characters long\n        .end_of_input()\n        .to_regex()\n    )\n\n    if expr.match('-Secr3t!'):\n      print(\"Matched\")  # prints matched\n\n\nFurther Documentation\n---------------------\n\nFurther API documentation is available on `edify.rftd.io \u003chttps://edify.readthedocs.io\u003e`_.\n\nWhy Edify?\n===========\n\nRegex is a powerful tool, but its syntax is not very intuitive and can be difficult to build, understand, and use. It gets even more difficult when you have to deal with backtracking, look-ahead, and other features that make regex difficult.\n\nThat's where Edify becomes extremely useful. It allows you to create regular expressions in a programmatic way by invoking the ``RegexBuilder`` class [#f1]_. The API uses the `fluent builder pattern \u003chttps://en.wikipedia.org/wiki/Fluent_interface\u003e`_, and is completely immutable. It is built to be discoverable and predictable.\n\n- Properties and methods describe what they do in plain English.\n- Order matters! Quantifiers are specified before the thing they change, just like in English (e.g. ``RegexBuilder().exactly(5).digit()``).\n- If you make a mistake, you'll know how to fix it. Edify will guide you towards a fix if your expression is invalid.\n- ``subexpressions`` can be used to create meaningful, reusable components.\n\nEdify turns those complex and unwieldy regexes that appear in code reviews into something that can be read, understood, and **properly reviewed** by your peers - and maintained by anyone!\n\n\n.. _SuperExpressive: https://github.com/francisrstokes/super-expressive\n\n.. [1]:\n\nLicense \u0026 Contributing\n======================\n\nThis project is licensed under `Apache Software License 2.0 \u003chttps://github.com/luciferreeves/edify/blob/main/LICENSE\u003e`_. See `Contributing Guidelines \u003chttps://github.com/luciferreeves/edify/blob/main/CONTRIBUTING.rst\u003e`_ for information on how to contribute to this project.\n\nContributors\n------------\n.. image:: https://contrib.rocks/image?repo=luciferreeves/edify\n\n\n.. rubric:: Footnotes\n\n.. [#f1] ``RegexBuilder`` class based on the `SuperExpressive`_ library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluciferreeves%2Fedify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluciferreeves%2Fedify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluciferreeves%2Fedify/lists"}