{"id":13595677,"url":"https://github.com/learnbyexample/py_regular_expressions","last_synced_at":"2025-05-14T14:09:15.865Z","repository":{"id":39105534,"uuid":"165224631","full_name":"learnbyexample/py_regular_expressions","owner":"learnbyexample","description":"Learn Python Regular Expressions step by step from beginner to advanced levels","archived":false,"fork":false,"pushed_at":"2025-04-18T04:24:25.000Z","size":5028,"stargazers_count":1787,"open_issues_count":0,"forks_count":226,"subscribers_count":40,"default_branch":"master","last_synced_at":"2025-04-20T15:54:10.684Z","etag":null,"topics":["ebook","exercises","learning-by-doing","python","regex","regular-expressions"],"latest_commit_sha":null,"homepage":"https://learnbyexample.github.io/py_regular_expressions/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/learnbyexample.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-11T10:22:19.000Z","updated_at":"2025-04-14T01:51:01.000Z","dependencies_parsed_at":"2023-02-16T04:31:23.259Z","dependency_job_id":"e5cea3ed-36db-4aa8-9834-95fb066a9b80","html_url":"https://github.com/learnbyexample/py_regular_expressions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learnbyexample%2Fpy_regular_expressions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learnbyexample%2Fpy_regular_expressions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learnbyexample%2Fpy_regular_expressions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learnbyexample%2Fpy_regular_expressions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/learnbyexample","download_url":"https://codeload.github.com/learnbyexample/py_regular_expressions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254160238,"owners_count":22024567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ebook","exercises","learning-by-doing","python","regex","regular-expressions"],"created_at":"2024-08-01T16:01:55.374Z","updated_at":"2025-05-14T14:09:15.789Z","avatar_url":"https://github.com/learnbyexample.png","language":"Python","readme":"# Understanding Python re(gex)?\n\nLearn Python Regular Expressions step-by-step from beginner to advanced levels with hundreds of examples and exercises. The standard library `re` and the third-party `regex` module are covered in this book. Visit https://youtu.be/2x2n7ynamm8 for a short video about the book.\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"./images/py_regex_ls.png\" alt=\"Understanding Python re(gex)? ebook cover image\" /\u003e\u003c/p\u003e\n\nThe book also includes exercises to test your understanding, which are presented together as a single file in this repo — [Exercises.md](./exercises/Exercises.md).\n\nFor solutions to the exercises, see [Exercise_solutions.md](./exercises/Exercise_solutions.md).\n\nYou can also use [this interactive TUI app](https://github.com/learnbyexample/TUI-apps/tree/main/PyRegexExercises) to practice most of the exercises from the book.\n\nSee [Version_changes.md](./Version_changes.md) to keep track of changes made to the book.\n\n\u003cbr\u003e\n\n# E-book\n\n* You can purchase the pdf/epub versions of the book using these links:\n    * https://leanpub.com/py_regex\n    * https://learnbyexample.gumroad.com/l/py_regex\n* You can also get the book as part of these bundles:\n    * **All books bundle** bundle from https://leanpub.com/b/learnbyexample-all-books or https://learnbyexample.gumroad.com/l/all-books\n    * **Learn by example Python bundle** from https://leanpub.com/b/python-bundle or https://learnbyexample.gumroad.com/l/python-bundle\n    * **Awesome Regex** bundle from https://leanpub.com/b/regex or https://learnbyexample.gumroad.com/l/regex\n* See https://learnbyexample.github.io/books/ for a list of other books\n\nFor a preview of the book, see [sample chapters](./sample_chapters/py_regex_sample.pdf).\n\nThe book can also be [viewed as a single markdown file in this repo](./py_regex.md). See my blogpost on [generating pdf/epub from markdown using pandoc](https://learnbyexample.github.io/customizing-pandoc/) if you are interested in the ebook creation process.\n\nFor the web version of the book, visit https://learnbyexample.github.io/py_regular_expressions/\n\n\u003cbr\u003e\n\n# Testimonials\n\n\u003eI 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.\n\u003e\n\u003e — [feedback on reddit](https://old.reddit.com/r/Python/comments/i0m2sy/i_know_python_basics_what_next/fzql5gh/)\n\n\u003cbr\u003e\n\n# Feedback and Contributing\n\n⚠️ ⚠️ Please DO NOT submit pull requests. Main reason being any modification requires changes in multiple places.\n\nI would highly appreciate it if you'd let me know how you felt about this book. It could be anything from a simple thank you, pointing out a typo, mistakes in code snippets, which aspects of the book worked for you (or didn't!) and so on. Reader feedback is essential and especially so for self-published authors.\n\nYou can reach me via:\n\n* Issue Manager: [https://github.com/learnbyexample/py_regular_expressions/issues](https://github.com/learnbyexample/py_regular_expressions/issues)\n* E-mail: `echo 'bGVhcm5ieWV4YW1wbGUubmV0QGdtYWlsLmNvbQo=' | base64 --decode`\n* Twitter: [https://twitter.com/learn_byexample](https://twitter.com/learn_byexample)\n\n\u003cbr\u003e\n\n# Table of Contents\n\n1. Preface\n2. Why is it needed?\n3. re introduction\n4. Anchors\n5. Alternation and Grouping\n6. Escaping metacharacters\n7. Dot metacharacter and Quantifiers\n8. Interlude: Tools for debugging and visualization\n9. Working with matched portions\n10. Character class\n11. Groupings and backreferences\n12. Interlude: Common tasks\n13. Lookarounds\n14. Flags\n15. Unicode\n16. regex module\n17. Gotchas\n18. Further Reading\n\n\u003cbr\u003e\n\n# Acknowledgements\n\n* [Python documentation](https://docs.python.org/3/) — manuals and tutorials\n* [/r/learnpython/](https://old.reddit.com/r/learnpython/), [/r/Python/](https://old.reddit.com/r/Python/) and [/r/regex/](https://old.reddit.com/r/regex/) — helpful forums for beginners and experienced programmers alike\n* [stackoverflow](https://stackoverflow.com/) — for getting answers to pertinent questions on Python and regular expressions\n* [tex.stackexchange](https://tex.stackexchange.com/) — for help on [pandoc](https://github.com/jgm/pandoc/) and `tex` related questions\n* [canva](https://www.canva.com/) — cover image\n* [Warning](https://commons.wikimedia.org/wiki/File:Warning_icon.svg) and [Info](https://commons.wikimedia.org/wiki/File:Info_icon_002.svg) icons by [Amada44](https://commons.wikimedia.org/wiki/User:Amada44) under public domain\n* [oxipng](https://github.com/shssoichiro/oxipng), [pngquant](https://pngquant.org/) and [svgcleaner](https://github.com/RazrFalcon/svgcleaner) — optimizing images\n* [David Cortesi](https://leanpub.com/u/dcortesi) for helpful feedback on both the technical content and grammar issues\n* **Kye** and [gmovchan](https://github.com/gmovchan) for spotting a typo\n* **Hugh**'s email exchanges helped me significantly to improve the presentation of concepts and exercises\n* [Christopher Patti](https://github.com/feoh) for reviewing the book, providing feedback and brightening the day with kind words\n* Users **73tada**, **DrBobHope**, **nlomb** and others for feedback in [this reddit thread](https://old.reddit.com/r/learnpython/comments/hmvnt1/my_python_regex_ebook_with_hundreds_of_examples/)\n* [mdBook](https://github.com/rust-lang/mdBook) — for web version of the book\n    * [mdBook-pagetoc](https://github.com/JorelAli/mdBook-pagetoc) — for adding table of contents for each chapter\n    * [minify-html](https://github.com/wilsonzlin/minify-html) — for minifying html files\n\nSpecial thanks to Al Sweigart. His [Automate the Boring Stuff](https://automatetheboringstuff.com/) book was instrumental for me to get started with Python.\n\n\u003cbr\u003e\n\n# License\n\nThe book is licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-nc-sa/4.0/).\n\nThe code snippets are licensed under MIT, see [LICENSE](./LICENSE) file.\n\n","funding_links":[],"categories":["Python","Books"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flearnbyexample%2Fpy_regular_expressions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flearnbyexample%2Fpy_regular_expressions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flearnbyexample%2Fpy_regular_expressions/lists"}