Metadata-Version: 2.1
Name: ret
Version: 0.1.0
Summary: A pure-python command-line regular expression tool for stream filtering, extracting, and parsing.
Home-page: https://github.com/ThatXliner/ret/
License: GPL-3.0-or-later
Keywords: regex,cli,tool,grep
Author: Bryan Hu
Author-email: bryan.hu.2020@gmail.com
Requires-Python: >=3.6,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Provides-Extra: regex
Project-URL: Bug Tracker, https://github.com/ThatXliner/ret/issues
Project-URL: Source Code, https://github.com/ThatXliner/ret
Project-URL: Say Thanks! , https://saythanks.io/to/bryan.hu.2020@gmail.com
Description-Content-Type: text/x-rst

===
Ret
===
A pure-python command-line regular expression tool for stream filtering, extracting, and parsing.

Installation
-------------

You can install this via

.. code-block:: bash

    python3 -m pip install ret


or using pipx

.. code-block:: bash

    pipx install ret

Ret is pure python (3.6+) with no dependencies.

Usage
------

Example
~~~~~~~~

You can use ``Ret`` to extract text via regex capture groups:

.. code-block:: bash

    $ git branch
    * master
    $ git branch | ret "\*\s+(\w+)" --group 1
    master

finding all occurrences of a pattern:

.. code-block:: bash

    $ ls | ret ".*\.py" findall
    foo.py
    bar.py

Background
-------------
I love ``grep``. But grep isn't really for text extraction.

For example, you cannot extract regexes via capture groups.

Since I wanted that functionality, I decided to build this, ``Ret``.

Why the name?
~~~~~~~~~~~~~

``Ret`` is an acronym for **r** egular **e** xpression **t** ool.


Why it can't replace grep (yet)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Grep is great for searching directories
Currently, ``ret`` can only read from a file or stdin.

Furthermore, you cannot guarantee that ``ret`` is installed on the machine.

Also, ``Ret`` relies on the (slow) python regex engine.

Feel free to contribute!

