Skip to content

Latest commit

 

History

History

PyRegexPlayground

Python re(gex)? playground

This TUI application is intended as an interactive playground for Python Regular Expressions. The app also includes a comprehensive cheatsheet and several interactive examples.

Installation

This app is available on PyPI as regexplayground. Example installation instructions are shown below, adjust them based on your preferences and OS.

# virtual environment
$ python3 -m venv textual_apps
$ cd textual_apps
$ source bin/activate
$ pip install regexplayground

# launch the app
$ regexplayground

To run the app without having to enter the virtual environment again, add this alias to .bashrc (or equivalent):

# you'll have to change the path
alias regexplayground='/path/to/textual_apps/bin/regexplayground'

As an alternative to manually managing such virtual environments, you can use https://github.com/pypa/pipx instead:

$ pipx install regexplayground
$ regexplayground

As yet another alternative, you can install textual (see Textual documentation for more details), clone this repository and run the pyregex_playground.py file.

Adjust the terminal dimensions for the widgets to appear properly, for example 84x25 (characters x lines). Here are some sample screenshots:

Sample screenshot from the Playground screen

Sample screenshot from the Interactive Examples screen


Guide

See app_guide.md

Ebook

See my Understanding Python re(gex)? ebook to learn regular expressions with hundreds of examples and exercises.

License

Code snippets are licensed under MIT LICENSE

Explanations and associated files (like cheatsheet.md) are licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License