
Where can you use regular expressions? Class structure overview and teaching methodology
Single Character Pattern, Sets, Range, Multi-Range, Wildcard, Escape and Control Characters
How to provide instructions to regular expression engine to fine tune criteria for matching
How to write concise patterns using ready-made shortcuts known as character classes
How to specify repetition, upper and lower bounds, optional experssions
Learn how HTML input controls use a regex pattern to validate user input, with the browser creating a JavaScript regular expression object and examples showing five-digit and nine-digit zip formats.
Discover how a regular expression engine evaluates patterns and text one character at a time. Understand greedy and lazy processing, backtracking, and look ahead and behind.
Learn left-to-right regex evaluation in Python by using alternative patterns, word boundaries, and optional quantifiers to match carpet and car, while minimizing backtracking through common subexpressions.
Experiment with greedy and lazy regex patterns to capture end-of-sentence digits and understand end-of-statement punctuation and backtracking effects. Use non-digit negated sets and word boundaries for precise matching.
Explore groups, backreferences, and replacements in Python regex to break patterns into sub-patterns, mark optional and repeating parts, and use named or non-capturing groups.
Learn python regular expressions to match numbers with thousand separators and optional decimals, using non-capturing groups, then apply back reference and word boundaries to remove duplicates with replacements.
Explore look ahead and look behind as zero width assertions that don’t consume characters, using positive and negative lookahead with preconditions for conditional regex, with password checks and nonenglish words.
Explore how poorly written regex patterns cause exponential runtime, reveal backtracking pitfalls, and apply fixes such as removing group-level repetition and adding word boundaries for near-constant performance.
Learn to fix regex performance by removing outer group repetition, using non-capturing groups or word boundaries, and testing with positive and negative cases to prevent exponential slowdowns.
Slide deck used for this section is available for download as part of resources for this article.
Master Python's re module to match digits with raw strings, use anchors and the match method, and validate integers with unit-tested patterns like is_integer and test_is_integer in a Jupyter notebook.
Explore and validate regex patterns using an interactive PyQt tool. Launch from the Anaconda prompt, test matches and groups, perform find/replace, and split operations to learn regex quickly.
Define regex patterns to parse robocopy log files, extract source and destination paths, capture the metrics table (directories, files, bytes), handle errors, and convert the data to json.
Learn to parse a RoboCopy log into a structured JSON file using regex. Define a LogMetrics class, capture directory paths and metrics, and store an error flag and message.
Use regular expressions to parse sensor data by extracting dates and temperature-humidity pairs from sample files, handle missing values, and prepare data for JSON conversion.
Parse sensor data with regex to produce a daily json structure, capturing date, temperature and humidity arrays. Demonstrate fast, scalable parsing from small to million-point files.
Extract healthcare data from hospital html reports and convert it to json using regex. Build three patterns to clean up html, extract rows, and capture cell values, handling empty cells.
Hi, and welcome to the Regular Expressions (Regex) with Python - Easy and Fast!
Regular Expression (regex) is a pattern detection language – they are typically used to search patterns in text, extract matching values, and data validation.
Regex is supported in many programming languages, including Python, C#, JavaScript, Perl, SQL, and more.
This course is designed to provide hands-on experience with regular expressions through various exercises and projects
I am Chandra Lingam, and I am your instructor.
Here are some typical uses of regular expression
Pattern Detection
Look for occurrences of a pattern using a concise language
Data Preparation
Data clean-up and preparation is often one of the most time-consuming activities
You can define the structure of data as a regex pattern and parse data
One good application of this is AWS Glue and Athena.
You can use regex to define the structure of a record in a plain text file, Create a table and query the file using SQL
Input Validation
You can implement a client-side check for input validation
For example, your app can guide the user to provide data in the correct format using regex.
As part of the zero-trust architecture, you need to validate input to your microservice
With regex, you can verify and validate data payloads in your service
Cloud Services
Several cloud services use regex for advanced configuration.
With the AWS web application firewall, you can allow or deny traffic based on a regex pattern
In Google Workspace, you can use regex for content filtering, Gmail route configuration, and to search for content in google docs
In Google Analytics, you can use regex to locate and transform matching data in your data set
Regex is also supported by several products such as SAP, Oracle, and SQL Server
Curriculum
The source code for this course is distributed using Github – so, you always have access to up-to-date code
As part of resources, you will get this high-quality cheat-sheet for regex language
And an interactive regex tool to write patterns
In the Python Regex features section, you will get familiar with various regex methods, their purpose, and how to unit test your pattern
In the regex language section, you will learn how to write patterns – starting from the simplest of patterns
You will also learn to incorporate regex in your HTML input types for validation
Regex engine puts the onus on the developers, that is us, to write efficient patterns
In this section, you will gain knowledge of regular expression engine that will help you write optimal patterns
There are several exercises for you to apply your new skills
We then look at performance and how poorly written patterns can degrade exponentially
You will learn how to optimize the patterns and address performance issues
There are four hands-on projects in this course
You will learn how to apply the regex for distinctly different data sets – unstructured log data, IoT sensor data, and parsing medical test data in HTML format
You will get prompt support through the course Q&A forum and private messaging.
I am looking forward to meeting you
Thank You!
Chandra Lingam
Cloud Wave LLC