Now updated in July 2020.
Welcome to Taming.Tech’s REGEX Course. No previous Regular Expressions experience required!
Regular expressions are also referred to as Regex, Regexes or Regexp (sometimes called a rational expression)
This course is designed to advance you from beginner to proficient. It is laid out logically so that you can incrementally build your regular expressions knowledge. Essential foundations are established first to facilitate in-depth comprehension of this key skill.
The real world and real-life examples explored in this course will deepen your understanding of REGEX and how to apply what you’ve learnt authentically and appropriately. Experimentation with a new skill is vital in exercising and integrating wider application; which is why we’ll explore practical examples because it ingrains the information contained here.
Our world is pretty much run by data now and those that know how to intelligently interrogate and manage data have a distinct advantage. Regular expressions unlock the powerful possibilities of any data set.
Data analysis is vital in a variety of industries and circumstances and being able to deploy and utilise this formidable tool will strengthen your skills set, enhance your confidence and give you an edge.
HOW CONFIDENT AM I? Take this course. If you don’t learn everything you need to know about Regular Expressions (Regex) in the next 30 days, I’ll refund every penny!
ASK YOURSELF:
Are you battling to learn Regex?
Have you tried many Regular Expression courses on Udemy and YouTube and you are still not getting it?
Are you a programmer that avoids using Regex because you are not confident?
Are you a beginner and you have heard about this and are not sure where to start?
As a Data Scientist, you know that this will help you query and clean data, but you don’t have a proper foundation to start from.
Have you started programming in Python, PHP, JavaScript, Java etc and you need to have a better understanding of Regular Expressions?
Are you using Google Sheets to clean data up and you would like to make the process faster?
Are you a system administrator using PowerShell and you would like to run scripts that make your job easier?
Do you know REGEX? How about advanced REGEX? Date Matching? Regular Expressions with Leap Years?
If you have answered YES to any of these questions – then you NEED this course!
What questions do we answer?
- Is regex case sensitive?
- Are regex the same for all languages?
- Is regex evil? 🙂
- How do Regular Expressions work in Python?
- What are the special characters in Regex?
- Can Regex contain spaces?
- How to exclude a string from Regex?
- How to escape a backslash in Regexes? And what regex characters need to be escaped.
- What are Regexp groups?
- When was Regex created?
- What are the differences between Greedy, Lazy and Possessive Quantifiers?
- And many more.
And the full 30 day no-questions-asked Udemy instant guarantee is your assurance of the quality and potential of this course.
Get started today by clicking “Buy Now” and get full, lifetime access to this unique Regular Expressions (Regex) course with all future updates and all current and future course materials included!
Here are some recent reviews for this Regex course…
5 Star – Regex can be a tricky beast to tame, but this course certainly helps one to get to grips with it. The course goes in to great depth and has plenty of good examples to explore. I was particularly interested in the Python and PowerShell sections, however the entire course is very informative. – Bryan Smith
5 Star – Regex annoyed me. Then I found Paul’s course. Well worth the money and time invested. The reason it’s worth it isn’t because of the content, no the content is actually tedious and annoying… it’s worth it because of how he positions the content, walks you through it and explains it in an INTUITIVE way. If more people taught the way Paul does, we’d be a smarter planet. Also the jokes are on ‘a neighborhood of dads’ level. – Eugenio Parages
Let’s get started!
The Basics
Welcome to the course! Let's figure out what Regex is and how it can help you.
Did you know that Regular Expressions, regex or regexp or sometimes called a rational expression, is a sequence of characters that define a search pattern? Usually, such patterns are used by string searching algorithms for "find" or "find and replace" operations on strings, or for input validation.
Let's look at regex101.com and see how you can use it.
The most basic regular expression consists of a single literal character, such as "a". It matches the first occurrence of that character in the string.
Because we want to do more than simply search for literal pieces of text, we need to reserve certain characters for special use. There are 12 characters with special meanings: the backslash , the caret ^, the dollar sign $, the period or dot ., the vertical bar or pipe symbol |, the question mark ?, the asterisk or star *, the plus sign +, the opening parenthesis (, the closing parenthesis ), the opening square bracket [, and the opening curly brace {, These special characters are often called “metacharacters”. Most of them are errors when used alone.
A caret ( ^ ) is fancy and can be used for negating and to symbolise the beginning of a string and also as a literal character.
Let's try a practical example using PowerShell on Windows. If you want to test this on a macOS or Linux machine, please check the resources.
Most metacharacters need to be escaped to be used as a literal character
In regular expressions, the dot or period is one of the most commonly used metacharacters.
The dot matches every single character, almost like a wildcard. The only exception is a line break character.
Here we look at a practical example on how to use your new knowledge of regex and test the query with Google sheets.
Use this Quick Quiz to test your knowledge before moving onto the next section.
Metacharacters, Character Sets, Character Ranges and Modes
We look at shorthand character classes d D w W s S
We focus on the most used non-printable characters t n v f r
With a “character class” or “character set”, you tell the regex engine to match only one out of several characters. Simply place the characters you want to match between square brackets.
You can use a hyphen inside a character set to specify a range of characters. [0-9] matches a single digit between 0 and 9. [a-z] matches a single character between a and z case-sensitively.
So this is really the opposite of the previous lesson. Whatever has a ^ caret in front of it is negated, it is not included.
Here we will be using a for escaping characters to make them literal, using - for ranges ^ for negating and using the ] literally.
We look at defining the shorthand character classes now, with the ranges and negated sets in.
Going to the practical examples with the Google Sheets again, this time we go further into cleaning your data in names and email addresses.
Modes, Anchors and Word Boundaries, Quantifiers, backreferencing
We look at the most common flags or modes in regular expressions.
Anchors are weird. They do not match any character at all. Instead, they match a position before, after, or between characters. They can be used to “anchor” the regex match at a certain position.
In this lesson, we will be looking at the ? Quantifier. This is a greedy quantifier.
In this lesson, we will be looking at the * Quantifier. This is a greedy quantifier.
In this lesson, we will be looking at the + Quantifier. This is a greedy quantifier.
Want to limit the repetition? This is the lesson fro you!
Don't you find that spaces mess with your data? Yes? Well, let's clean them up.
This lesson on repetition operators or quantifiers explains the difference between greedy, lazy and Possessive. Greediness and laziness determine the order in which the regex engine tries the possible permutations of the regex pattern. A greedy quantifier first tries to repeat the token as many times as possible, and gradually gives up matches as the engine backtracks to find an overall match. A lazy quantifier first repeats the token as few times as required, and gradually expands the match as the engine backtracks through the regex to find an overall match.
Hey, these sheet examples make me realise how much we have learned. I hope it does it for you too.
By placing part of a regular expression inside round brackets or parentheses, you can group that part of the regular expression together. This allows you to apply a quantifier to the entire group or to restrict alternation to part of the regex.
Do you want one or the other? This is alternation!
Do you need a group, but you don't want to do anything with it?
Following on from our previous PowerShell example, we now use groups in PowerShell. Will the excitement ever end?
Our names and email addresses are almost clean. This is the next step.
Positive and Negative Lookahead and Lookbehinds
Lookahead and lookbehind are collectively called “lookaround”. The difference between these and a ^ symbolising the start of a string or line, is that lookaround actually matches characters, but then gives up the match, returning only the result: match or no match. Lookarounds allow you to create regular expressions that are impossible to create without them or would be very difficult.
This is like the previous lesson, but are the negatives.
Let's try and make these easy to understand.
Basics Complete
You have made it! Now look at the rest of the lessons and see which ones you want to do.
Advanced Examples
Get HTML colour codes and Hex colour codes and test if they are valid. Let's go!
Are you dealing with US or UK date formats? Do you need to change it to your format or even the universal date format? Regex can help.
Bryan, one of the students, figured out how to reference on REGEX101.
This is as much as you might ever need to know about how to match dates using Regex.
Examples and Exercises - Installing PHP, Python and Visual Studio Code
Do you need to run PHP on your Windows machine? Not to worry, this simple lesson will show you how to have a local web server set up and running in no time.
I love Visual Studio Code. Let's install it and use it for PHP, Python, HTML5 etc
Password Matching
Email Matching
Let's break down matching of email addresses.
Q&A Answers
Question from Eugenio Parages in the Q&A section of the course.
Double Letter Detection
Could you do an example as the one below to find double letters please?
test_cases = [
"I'm going to read a book.",
"Green is my favorite color.",
"My name is Aaron.",
"No doubles here.",
"I have a pet eel."
]
for tc in test_cases:
print(re.search(r"(w)1", tc))
Bonus
You have made it to the end. Please see the attached resources for the best courses to carry on with your learning.