Go to content

Ilia Kurenkov - re-Discovering Python's Regular Expressions

Ilia Kurenkov - re-Discovering Python's Regular Expressions [EuroPython 2016] [19 July 2016] [Bilbao, Euskadi, Spain] (https://ep2016.europython.eu//conference/talks/rediscovering-pythons-regular-expressions) As Armin Ronacher pointed out in a recent blog post, there is more to Python's regular expression module than meets the eye. His post made me wonder what other “hidden gems” are stashed away in Python’s `re`. In the talk I share what I’ve learned about the inner workings of this extremely popular and heavily used module. ----- Anyone who has used Python to search text for substring patterns has at least heard of the regular expression module. Many of us use it extensively for parsers and lexers, extracting information . And yet we know surprisingly little about its inner workings, as Armin Ronacher demonstrated in his recent blog post, “Python's Hidden Regular Expression Gems”. Inspired by this, I want to dive deeper into Python’s `re` module and share what I find with folks at EuroPython. My goal is that at the end of the day most of us walk away from this talk with a better understanding of this extremely useful module. Here are a few examples of the kinds of things I would like to cover: - A clear presentation of `re`’s overall structure. - What actually happens behind the scenes when you “compile” a regular expression with `re.compile`? - What are the speed implications of using a callable as the replacement argument to `re.sub`? - re.MatchObject interface: `group` vs. `groups` vs `groupdict` To keep the talk entertaining as well as educational I plan to pepper it with whatever interesting and/or funny trivia I find about the module’s history and structure. Prerequisites: If you've ever used the `re` module, you should be fine :)

July 17, 2016