Skip to content

Latest commit

 

History

History

PyRegexExercises

Python re(gex)? exercises

This TUI application is intended to help you practice Python regular expressions. There are more than 100 exercises covering both the builtin re and third-party regex module.

Installation

This app is available on PyPI as regexexercises. 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 regexexercises

# launch the app
$ regexexercises

Note
If you are on Windows, using the Windows Terminal is recommended. See this issue for Virtual Environment commands and other details.

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 regexexercises='/path/to/textual_apps/bin/regexexercises'

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

$ pipx install regexexercises
$ regexexercises

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

Adjust the terminal dimensions for the widgets to appear properly, for example 84x25 (characters x lines). Here's a sample screenshot:

Sample Python regex exercise

Guide

See app_guide.md

Video demo

You can view a demo video about this app on Youtube: https://youtu.be/0oXPeF8HutQ

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

Exercise questions and associated files (like questions.json) are licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License