Scripting and automation tasks often need to extract particular portions of text from input data or modify them from one format to another.
This book will help you learn Python Regular Expressions, a mini-programming language for all sorts of text processing needs.
The book heavily leans on examples to present features of regular expressions one by one. It is recommended that you manually type each example and experiment with them.
Both standard re module and popular third party regex module is covered in this book.
Exercises are also included to test your understanding.
You should have prior experience working with Python, should know concepts like string formats, string methods, list comprehension and so on.
I love your books on regex...As a student from the Digital VLSI space, it is indeed useful now and definitely in the future. It's really well written and really easy to understand the examples — feedback on reddit
For a preview of the book, see sample chapters at
Visit https://github.com/learnbyexample/py_regular_expressions for code snippets and exercise files. The repo also has solutions for exercises.
Based on the book contents as well as the exercises, I made an interactive GUI app with 75 questions on `re.search`, `re.sub`, `re.split` and `re.findall` that'll test your understanding of anchors, alternation, grouping, escaping metacharacters, dot metacharacter, quantifiers, character class, grouping, lookarounds, flags, etc.
You'll get PDF and EPUB versions of the book.