Skip to content

samyakbardiya/trex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TReX

GitHub Release Go Reference Go Report Card License: MIT

TReX is a terminal-based tool for writing, visualizing, and testing Regular Expressions. Designed for efficiency, it provides a keyboard-driven interface for rapid feedback on your regex experiments—all within your terminal.

asciicast

Why TReX?

xkcd comic about Regular Expressions

Sometimes you just want to quickly test out a regex without switching between multiple browser tabs or online tools. TReX lets you see how your regex interacts with your text in real time—all within your terminal.

  • Quick feedback: Validate and debug regex patterns instantly.
  • Integrated testing: Load files and experiment with regex combinations.
  • Efficient workflow: Stay in your terminal and keep your focus on writing code.

Okay, but why "TReX"?

TReX, is a playful fusion of TUI and RegEx. The T comes from TUI, while ReX from RegEx, hence TReX. :t-rex: roar!

Features

  • Written in Go: Fast and portable.
  • External file loading: Test regex patterns against real-world data.
  • Keyboard-driven interface: Navigate without the need for a mouse.
  • Mouse support: For users who prefer it or need it.

Installation

  • Install from Go Package Reference:

    go install github.com/samyakbardiya/trex@latest
OR from the source

From the source

  • Clone the repository:

    git clone https://github.com/samyakbardiya/trex.git
    cd trex
  • Build the application:

    go install
    go build
    • Optionally, you can copy the binary to your PATH:

      cp ./trex ~/.local/bin
  • Verify the installation:

    ./trex --version

Usage

  • Start TReX:

    trex
  • Load a file into TReX:

    trex file.txt
  • Advanced usage: Check out the help flag for more commands:

    trex --help

Roadmap

  • Editable Text Area: Replace the read-only view with an editable interface.
  • Local History: Implement local history similar to shell history, navigable with arrow keys.
  • Syntax Highlighting: Add syntax highlighting for the RegEx input.
  • Toggleable Flags: Implement quick toggling for RegEx flags, such as:
    • g (global)
    • m (multi-line)
    • i (case-insensitive)
    • U (ungreedy)

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests. For major changes, please open an issue first to discuss what you'd like to change.

Implementation

Developed in Go, TReX leverages:


Made during FOSS HACK 2025 in India 🇮🇳

By Samyak Bardiya & Mital Sapkale