Skip to content

Latest commit

 

History

History
65 lines (40 loc) · 2.09 KB

README.md

File metadata and controls

65 lines (40 loc) · 2.09 KB

rt - Regex-based Text Extraction Utility

rt is a command-line tool written in Rust designed to make text extraction a breeze using regular expressions and capture groups. Unlike traditional utilities like rg, grep, awk, or sed, rt focuses specifically on simplifying text extraction tasks, providing a straightforward and intuitive interface for regex-based text processing.

Features

  • Regex-based Extraction: Use regular expressions and capture groups to extract specific text patterns effortlessly.
  • Simplicity: Designed for ease of use, providing a straightforward and clear syntax for text extraction.
  • Rust-Powered: Built with Rust, rt offers performance, safety, and reliability.

Installation

From Source

  1. Ensure you have Rust installed. If not, install it from Rust's official website.
  2. Clone the rt repository:
git clone https://github.com/ThatXliner/rt.git
  1. Navigate to the rt directory and build the tool:
cd rt
cargo build --release
  1. Once built, the executable will be located at ./target/release/rt.

Usage

Examples:

Extract email addresses from a file:

rt '([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})' file.txt --doc

Extract phone numbers from a string:

echo "Contact: 123-456-7890, 987-654-3210" | rt '(\d{3}-\d{3}-\d{4})' 

Getting the folder names of tarballs:

ls | rt '(.+?)\.tar\.gz' --group 1 

FAQ

Why rt?

rt stands out for its simplicity and focus on text extraction via regex capture groups. It provides a more streamlined and intuitive experience compared to other command-line tools, making text extraction tasks more accessible and manageable. It aims to offer a clear and easy-to-understand syntax without the complexities often associated with Perl on the command line.

What's with the name?

It is a Rust rewrite of Ret, with a better interface.


Feel free to contribute, report issues, or suggest improvements by visiting the rt GitHub repository. Your feedback is valuable!