I recently updated my Python re(gex)? ebook.
Get the ebook using either of these sites:
For web version of the book, visit https://learnbyexample.github.io/py_regular_expressions/. Code snippets, example files, sample chapters, markdown source, etc are available on GitHub: https://github.com/learnbyexample/py_regular_expressions. I'm generating the PDF/EPUB versions using pandoc.
This book covers both
re module and the third-party regex module. Examples are used extensively, please follow along by typing them out. Exercises are included to test your understanding and chapters have cheatsheets for easy reference.
Table of Contents
- Why is it needed?
- re introduction
- Alternation and Grouping
- Escaping metacharacters
- Dot metacharacter and Quantifiers
- Interlude: Tools for debugging and visualization
- Working with matched portions
- Character class
- Groupings and backreferences
- Interlude: Common tasks
- regex module
- Further Reading
Hope you find the book useful. I would be grateful for your feedback and suggestions (via email or twitter).
Happy learning :)