https://github.com/learnbyexample/py_regular_expressions/tree/master/interactive_exercises Skip to content Sign up * Why GitHub? + Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Issues - + Integrations - + GitHub Sponsors - + Customer stories - * Team * Enterprise * Explore + Explore GitHub - + Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - + Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing + Plans - + Compare plans - + Contact Sales - + Education - [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} learnbyexample / py_regular_expressions Public * Notifications * Star 972 * Fork 139 * * Code * Issues 1 * Pull requests 0 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show Loading {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default Loading View all tags py_regular_expressions/interactive_exercises/ Go to file py_regular_expressions/interactive_exercises/ Latest commit @learnbyexample learnbyexample PDF/EPUB versions free till 2021-12-31 ... 5ff97ac Nov 30, 2021 PDF/EPUB versions free till 2021-12-31 5ff97ac Git stats * History Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time . . README.md PDF/EPUB versions free till 2021-12-31 Nov 30, 2021 questions.json added more questions, updated README Nov 23, 2021 regex_practice.py added more questions, updated README Nov 23, 2021 regex_practice_example.png added solution button, improved styling Nov 15, 2021 representation.png added more questions, updated README Nov 23, 2021 visual_string.png added more questions, updated README Nov 23, 2021 About Instructions Notes TODO README.md About A GUI app written in tkinter to help you practice Python regular expressions. The script has been tested for python3.8 and above versions on Linux. This is likely to be functional on Windows/Mac as well. The following functions are currently supported: * re.search() * re.sub() * re.findall() * re.split() The app automatically checks and highlights test strings based on user input. Here's a screenshot: [regex_prac] Instructions Download regex_practice.py and questions.json or clone this repo as shown below. $ git clone --depth=1 https://github.com/learnbyexample/py_regular_expressions $ cd py_regular_expressions/interactive_exercises/ # use py instead of python3 for Windows $ python3 regex_practice.py Your progress will be saved in a new file named user_progress.json. If you close the app and launch it again, already solved questions will be automatically skipped. There are 75 questions in total. You can pass an integer value as command-line argument to directly open that particular question (this would also be skipped if it is already answered). # use py instead of python3 for Windows # opens 50th question $ python3 regex_practice.py 50 Notes * Use appropriate anchors based on whether string or line is used in the question description. * By default, visual string radio option is active. It shows the test strings in the same way you'd see from the output of print() function. In case of re.split() and re.findall() functions, the output column shows the list return value. The representation radio choice shows the test strings using the repr() function, this is useful when the test strings contain whitespace characters. Here's a screenshot to show the difference between these two options: [visual_str] [representa] * Backticks are used in the question descriptions to highlight search and replace terms. * User input entered via Pattern and Replace boxes will always be treated as raw-strings. For this reason, raw-strings are used for the reference solutions as well. * These exercise questions have been adapted from my Python re (gex)? ebook (free to read online and PDF/EPUB versions are currently free to download till 31-Dec-2021). See Exercises.md for all the exercise questions from this book. TODO * Highlight portion of test strings that match the user pattern and show live output -- these features will help in debugging solutions * Add support for arguments like count for re.sub, maxsplit for re.split, etc * Add support for re.subn, re.fullmatch, re.finditer, re.Match, etc * Add support for third-party regex module * Refactor * Add tests? * Etc * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.