I wrote a TUI application to help you practice Python regular expressions interactively. There are more than 100 exercises covering both the builtin re
and third-party regex
module. Most of the exercises from the Understanding Python re(gex)? ebook have been used in this interactive app.
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
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, you can install textual
(see Textual documentation for more details), clone my TUI-apps 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:
See app_guide.md
You can view a demo video about this app on Youtube: https://youtu.be/0oXPeF8HutQ
See this repo commit for an earlier version written in tkinter
. That GUI app had 75 questions and supported only re.search()
, re.sub()
, re.findall()
and re.split()
functions.