
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Explore the Python re module for handling patterns and regular expressions. Import re in idle, inspect its methods with help and dir to prepare for regex work in Python 3.8+.
Learn how raw strings in python prevent escape sequence interpretation by prefixing with r, avoiding syntax errors and unintended whitespace when building regular expressions.
Learn how to use the re.compile() method to convert a regex pattern string into a reusable regular expression object for repeated searches, including raw strings and four-digit matches.
Use the re.search method to locate the first pattern in a string, with optional flags, returning a match object with span indices and noting that no match yields None.
Explore how re.match() tests for a pattern at the beginning of the string using backslash w, returning a match object with span and NoneType when no match.
Explore how re.fullmatch() requires the entire string to match the pattern, unlike re.match, with examples using a 285 character string and the dot, newline, and backslash w.
Learn how to use re.findall to search a string, find three consecutive digits with a pattern, and return all matches as a list in left-to-right order.
Explore how the R module's re.sub method replaces all uppercase words with the word index using a pattern, replacement, and target string.
Learn how the subn method returns a tuple with the new string as the first element and the number of replacements as the second, compared to the sub method.
Learn how to use groups and group methods in Python's regular expressions to extract patterns from a string, such as a word ending in x and the date 19th February.
Explore the start, end, and span methods to locate group boundaries in a target string, capture start and end indexes, and verify results by slicing the string.
Explore optional flags in Python regular expressions, including ignore case, dot all, and verbose, and see how they affect match, search, and find all.
Explore metacharacters in Python regular expressions, focusing on the dot as a wildcard that matches any character except newline, with plus repetition, grouping, and the dotall flag to include newlines.
Explore how the caret anchors patterns to the start of a line, using \w{3} to match a three-letter word, and how re.M enables multi-line matching.
Explore how the dollar sign metacharacter matches the end of strings or lines with the multi-line flag, using a capturing group and backslash capital W for non-alphanumeric endings.
Master the asterisk metacharacter in Python regular expressions, where the preceding expression repeats zero or more times, greedily, with examples using digits \d and patterns starting with capital E.
Discover the plus sign in Python regular expressions, repeating the preceding element one or more times greedily, and compare it with the asterisk through practical digits and word examples.
Explore metacharacters in regular expressions with the question mark, which limits repetition to 0 or 1 and produces non greedy behavior, illustrated with digit and character examples.
Explore how the backslash signals special sequences like \d and \w, escape the dot to match actual punctuation, and apply escaping to characters like * and ?.
Explore the meaning and role of square brackets in regular expressions, representing sets of characters and ranges, with examples of digits, letters, negation, and two-character patterns.
Explore common character classes in Python regular expressions, including digits, letters, whitespace, and alphanumeric sets, and learn to use negation and counts to match patterns in a target string.
Explore how the curly braces metacharacter controls repetition in Python regex, using {4} and {3,5} to match words with word boundaries, plus greedy and non greedy options.
Learn the pipe meta character in Python regular expressions, which links A|B|C patterns, is evaluated left to right, not greedy, and stops at the first match for efficient searches.
Explore special sequences in regex: backslash A and backslash Z, and compare them with ^ and $. See how their behavior changes for single-line versus multi-line strings.
Explore the backslash b and backslash B word boundary sequences in Python regular expressions. Learn that \b marks word edges, while \B marks boundaries inside a word.
Explore how \d matches digits 0–9 and \D matches non digits, their equivalence to [0-9], and how to use them in patterns with grouping, \W, and non alphanumeric contexts.
Explore how the \s and \S sequences match whitespace and non-whitespace characters. Apply patterns using \S{8,} to capture eight or more consecutive non-whitespace characters.
Master python regular expressions with the sequences \w and \W to match word characters, including underscore, and non-alphanumeric symbols, with \s for whitespace and \w{3,4,5} to capture 3-5 alphanumeric characters.
Explore extension notations and non-capturing groups in regular expressions to manage many groups without retrieving their contents, using non-capturing syntax and group handling.
Learn how named groups in Python regular expressions let you reference subpatterns by name using the syntax (?P<name>pattern) and use group dict to retrieve mapping of group names to strings.
Practice positive look ahead assertions in Python regex using (?= pattern) to match only when the following pattern fits. See euro before a letter and digits after words with findall.
Learn how negative lookahead assertions work using ?! to ensure a match is not followed by digits 5–9 or non-digits, with examples for digits and words not followed by whitespace.
Explore the positive lookbehind assertion in Python regular expressions, including its syntax, how to match patterns preceded by a specified subpattern, and practical examples with digits and comma-space preceded words.
Explore negative lookbehind assertions in Python regular expressions, including their syntax and avoiding matches preceded by a pattern. See digits not preceded by whitespace and negative lookahead for x.
Apply Python regular expressions to a bookshelf data file, extracting book titles under 25 characters and authors who published after 2000 using the findall method with semicolon-separated fields.
Explore how to extract last names and phone numbers from a Python phone book using regular expressions, including area codes in parentheses and tab separators.
Use regular expressions to search and filter Windows log messages, extracting date, time, source, and event ID for critical entries between January 11 and 16, 2020.
Learn to pattern-match website URLs with regex, extracting online shopping links from a sample data file using findall and a robust http(s) URL pattern.
Analyze US stock data by applying Python regular expressions to extract company names and revenues under 50 billion USD, along with volume and the PE ratio from a text file.
Lead a final project by designing and validating a command-line user registration flow using Python regex patterns to check names, birth date, email, username, password, and payment details.
Master regular expression patterns to enforce input rules for first and last names, date of birth, email, username, password strength, and credit card details in a practical project.
Install openpyxl, verify the import, and learn to use Python regular expressions to filter and extract data from Excel files with a sample employee workbook.
Load the workbook with openpyxl, inspect sheet names, reference a sheet by name, and convert rows into semicolon-delimited strings joined by a newline for regex.
Learn to use Python regular expressions to filter Excel data and extract employee last names for salaries between 24,000 and 29,999, using semicolon-delimited rows and grouped patterns.
Use a regular expression to filter Excel file, selecting first names p to z and ten-digit phone numbers that start with an even digit and end with an odd digit.
Explore filtering data in Excel files using regular expressions to extract employees in New York from the sales department, including first name, last name, and phone number.
Apply the negative lookahead assertion to filter Excel data, matching employees whose addresses do not end in Miami and returning their last names with department and phone number fields.
Explore using regular expressions to filter data in a pandas data frame by reading html content, applying regex patterns, and practicing five exercises.
Extract mutable data types from a pandas data frame by converting the table to a string and applying a regex to pull byte array, dict, list, and set.
Apply a regular expression pattern to pandas data frames to filter rows where the syntax column contains curly braces in the correct order, identifying dict and set data types.
Use a regular expression to filter pandas dataframes by data type names of four or fewer characters, and extract corresponding descriptions with findall from the dataframe.
Apply a regular expression to filter pandas dataframes by odd IDs and extract the first ten characters of each description using a pattern for odd endings.
Filter a pandas data frame to include types whose syntax contains at least one floating point number, using a regular expression, returning complex, dict, float, frozenset, list, set, and tuple.
Celebrate finishing this course on Python regular expressions and gain a better understanding of this vast and complex topic through many examples.
COURSE STATUS: LEGACY
This course is no longer being maintained, starting January 1st, 2026.
Although the content still brings real value, updates and support have been discontinued.
Probably the most PRACTICAL Python RegEx course on Udemy.
No slides, no boring theory, no rambling, no chitchat. Just coding!
Quizzes, Exercises, Notebooks, Real-Life Examples and Projects.
Python 3 Regular Expressions PDF Cheat Sheet is included.
A Certificate of Completion is also included at the end.
What others have to say about my courses?
"What an incredible value and learning experience!" by Sean A.
"Excellent material. Kudos to a great instructor with a vast level of creativity." by Anthony W.
"The instructor is an excellent professional, skillful and engaging." by Georgios T.
Why would you take this course?
Do you want to polish your Python coding skills without spending money on books and boring theoretical courses?
Have you ever been confused by the Regular Expressions topic and wanted a detailed step-by-step learning guide?
Would you like to be able to perform Basic to Advanced pattern matching tasks using the amazing power of Python?
"As a Python beginner, I find this course is concise, easy to understand and structured. Also, Mihai responds to my questions during the course promptly. I highly recommend this training course." by Johnny Wang
What are the steps you're going to take from Beginner to Advanced level skills?
Section 1 - Some Initial Thoughts
Section 2 - Regular Expressions Cheat Sheet
Section 3 - Methods and Objects
Section 4 - Metacharacters and Special Sequences
Section 5 - Extension Notations and Assertions
Section 6 - Small Real-Life Projects
Section 7 - PROJECT: Validating User Account Details
Section 8 - Regular Expressions in Excel Spreadsheets: Filtering Employee Data
Section 9 - Regular Expressions in Data Analysis: Filtering HTML Page Data
Section 10 - Final Section
"I can say this man is going on smoothly and perfectly, explaining in the most empirical way." by Kolapo A.
Important information before you enroll!
Don't forget you are covered by a 30-day money back guarantee, full refund, no questions asked.
Once enrolled, you have unlimited, 24/7, lifetime access to the course from any device.
"Very thorough course. Includes plenty of details and examples without being boring. Explanations are given at a very practical level." by Gary Scarr
Let's get started!
Enroll now and I'll see you in the first lecture!