Python: Renaming PDFs using text inside a document with regex

Опубликовано: 27 Март 2026
на канале: Stephen Codes
3,297
45

In this tutorial, we expand on renaming PDFs using regular expressions (regex). This is one of the many examples of using regex, if you have different requirements it will require a different regex expression.

I have posted a written explanation of the regular expression used in the video on GitHub.

Code (pdf_regex branch): https://github.com/steve-codes/PDF-re...
Regex101: https://regex101.com/
Regex cheat sheet: https://www.debuggex.com/cheatsheet/r...
StackOverflow post on the expression: https://stackoverflow.com/questions/2...

If you have any questions leave them down below and I'll try and respond (hopefully more quickly this time).

Chapters:
00:00 Intro
00:18 Requests & start
01:28 Reviewing code
07:34 Reviewing the regex expression
11:23 Alt. regex w/o formatting
12:46 Example run with regex
14:11 Using a list of names to rename