Giter Site home page Giter Site logo

regextester's Introduction

RegexTester Template

A CLI tool for testing regular expressions (regex) using various regex languages.

Table of Contents

Installation/Setup

Requirements

regext was tested on python version 2.7.10 and it should work with any Unix/Linux system. The embedded perl code was tested on perl version 5.18.2.

Install

To install system wide run:

cd /path/to/regextester && sudo bash setup.sh install

Uninstall

To uninstall the regext program run:

cd /path/to/regextester && sudo bash setup.sh uninstall

Usage and Examples

Program help:

regext --help

regext reads from stdin for the test string, so you could | pipe from echo or cat.

Example 1:

echo "abcd" | regext -e '/(a(b)c)d/'

Example 1 output:

Match Successful!
Match number 1, with 2 group(s):
Full Match = abcd
Group[1] = abc
Group[2] = b

The default -l/--lang option is pcre, you could specify python's regex like so:

echo "abcd" | regext -l py -e '(a(b)c)d'

List of all available regex languages you can run tests with:

  • pcre (default) (synonym: php)
  • perl (synonym: pl)
  • python (synonym: py)

To use python's regex flags use the -f/--flags option after the --lang specification.

For a single flag:

-f I

For multiple flags:

--flags="I|S"

If you expect a lot of output from matches, pipe to less with the -R option:

echo "abcd" | regext -l py -f I -e '(a(b)c)d' | less -R

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.