Metadata-Version: 2.1
Name: regexplain
Version: 0.1.0a16
Summary: Build and explain Python Regex patterns in a human-friendly way
Keywords: regex
Author-Email: "Aalap Shah (aka fishfin)" <shah.aalap@gmail.com>
License: MIT License
         
         Copyright (c) 2025 Aalap Shah
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development
Classifier: Topic :: Utilities
Project-URL: Homepage, https://gitlab.com/shah-aalap/python-regexplain
Requires-Python: >=3.10
Requires-Dist: pyyaml>=6.0.2
Description-Content-Type: text/x-rst

.. |package-name| replace:: regexplain

.. |pypi-version| image:: https://img.shields.io/pypi/v/regexplain?label=PyPI%20Version&color=4BC51D
   :alt: PyPI Version
   :target: https://pypi.org/projects/regexplain/

.. |pypi-downloads| image:: https://img.shields.io/pypi/dm/regexplain?label=PyPI%20Downloads&color=037585
   :alt: PyPI Downloads
   :target: https://pypi.org/projects/regexplain/

regexplain
##########

|pypi-version| |pypi-downloads|

Description
***********

`regexplainer` consists of two main components:
 - Explainer (technically ``RegexTokenizer``): It tokenizes a given input regex string pattern, and its ``explain()`` method then explains in simpler English what is going on. The output is customizable, i.e. whether you want to see the flags, where a particular token starts and its length, to see the full textual sub-token along with its break-down, etc. In your IDE, check the init parameters to the class. This is working pretty well and you can use it without many issues.
 - Builder (technically ``RegexBuilder``): This is a class that you can instantiate, and start using its properties and methods to build a regex without having to remember the actual Regex syntax. Your Python IDE will prompt you once you type in a letter that is close to what you want to do. Unfortunately, this is very rough around the edges and needs quite a bit of work. Am working on it.

Note: This is an alpha version, and things may change quite a bit.

.. code-block:: python

   from regexplain import RegexTokenizer


   regtokens = RegexTokenizer(r"[^\w\s-]")
   regtokens.explain()

   """
   Explaining Full Pattern: [^\w\s-]
   ┌──
   │   [Span, Length] (0, 8), 8
   │   [Flags] re.NOFLAG
   │  ┌──
   │──│ [^
   │  │   [@0:Character Set] Matches any character not in the set
   │  │   [Span, Length] (0, 8), 8
   │  │   [Flags] re.NOFLAG
   │  │  ┌──
   │  │──│ \w
   │  │  │   [@1:Character Class:Word] Matches any word character (alphanumeric and underscore)
   │  │  │   [Span, Length] (2, 4), 2
   │  │  │   [Flags] re.NOFLAG
   │  │  └──
   │  │  ┌──
   │  │──│ \s
   │  │  │   [@2:Character Class:Whitespace] Matches any whitespace character (space, tab, line-break)
   │  │  │   [Span, Length] (4, 6), 2
   │  │  │   [Flags] re.NOFLAG
   │  │  └──
   │  │  ┌──
   │  │──│ -
   │  │  │   [@3:Literal] Matches a single character from the list '-' (case-sensitive)
   │  │  │   [Span, Length] (6, 7), 1
   │  │  │   [Flags] re.NOFLAG
   │  │  └──
   │  │ ]
   │  │   [@0:End] Token closed
   │  └──
   └──
   """