Pattern Matching Using Regular Expressions
This is extended with some relatively esoteric points that most people don't need to know.
This is an interative teaching aid, and must be downloaded and run.
This edition does not mention Python as such, but earlier ones did.
Mastering Regular Expressions, Third Edition Jeffrey E.F. Friedl, O'Reilly
Introduction to automata theory, languages, and computation by John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman, 3rd ed. (2007), Pearson Addison Wesley