Skip to main content

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

Project description

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

Installation

You can install this via

python3 -m pip install ret

or using pipx

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:

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

finding all occurrences of a pattern:

$ 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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ret-0.1.0.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

ret-0.1.0-py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page