
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.
Use online regex tools: There are many online tools that allow you to test your regular expressions. They provide an easy-to-use interface that shows you what your regex is matching.
Keep it simple: Try to keep your regular expressions as simple as possible. Use basic patterns such as character sets, quantifiers, and anchors.
Use capture groups: Use parentheses to create capture groups. This can help you extract specific parts of a match.
Be specific: Be specific in your regular expressions. Instead of using a dot to match any character, use a character set to match only the characters you want.
Use lookahead and lookbehind: Lookahead and lookbehind are powerful features that allow you to match patterns that come before or after a certain pattern.
Use flags: Regular expressions have flags that modify their behavior. For example, the global flag can be used to find all matches in a string, and the case-insensitive flag can be used to make the regex case-insensitive.
Test your regex: Always test your regular expressions on different inputs to make sure they work as expected.
Use resources: There are many resources available online that can help you learn regular expressions. Use them to your advantage.
Document your regex: Document your regular expressions by adding comments to your code. This will make it easier for others (and your future self) to understand what the regex is doing.
Practice: Practice makes perfect. Regular expressions can be difficult to master, so the more you practice, the better you'll become.
Let's look at regex101.com and see how you can use it.
In regular expressions (regex), literal characters are characters that match themselves exactly, without any special meaning or interpretation. For example, the letter "a" in a regex pattern matches the literal character "a" in the input text.
Literal characters can be combined with other regex elements, such as character classes, quantifiers, and anchors, to create more complex patterns that match specific text patterns.
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.
In regular expressions (regex), the "^" symbol has different meanings depending on its position within the pattern.
When "^" appears at the beginning of a regex pattern, it represents the start of a line or string. This means that the pattern that follows must match the beginning of the line or string. For example, the pattern "^hello" would match the word "hello" only if it appears at the beginning of a line or string.
When "^" appears inside a character set (enclosed in square brackets), it negates the character set. This means that the pattern that follows will match any character that is not in the set. For example, the pattern "[^abc]" would match any character that is not "a", "b", or "c".
It's important to note that the "^" symbol has different meanings depending on its position within the pattern, so you need to be careful when using it. If you want to match the literal "^" character in a pattern, you can escape it with a backslash ().
Most metacharacters need to be escaped to be used 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.
In regular expressions (regex), the "." (dot) metacharacter represents any single character, except for a line break. This means that the dot can match any character, such as a letter, number, or punctuation mark, except for a newline character.
For example, the pattern "a.b" would match the string "acb", "a&b", or "a b", because the dot can match any character in between the "a" and "b".
The dot metacharacter can also be combined with other regex elements, such as quantifiers and character classes, to create more complex patterns that match specific text patterns. For example, the pattern ".*" (dot and asterisk) would match any sequence of characters, including an empty string.
It's important to note that the dot metacharacter matches only one character, so if you want to match multiple characters, you need to use a quantifier such as "*", "+", or "{n,m}".
Here we look at a practical example on how to use your new knowledge of regex and test the query with Google sheets.
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.
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 for 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.
Regex lookaround is a feature that allows you to specify a pattern to match only if a certain condition is met ahead or behind the pattern. Lookaround includes lookahead and lookbehind assertions.
Lookahead assertion matches a pattern only if it is followed by another pattern without including the matched pattern in the result. Conversely, lookbehind assertion matches a pattern only if it is preceded by another pattern, again without including the matched pattern in the result.
Unlike other regex symbols such as the caret (^) or dollar sign ($), lookaround actually matches characters but does not include them in the final result. Lookaround assertions are useful when you need to specify a pattern based on a specific context, but you don't want that context to be included in the final result. They can help create more complex regex patterns that would otherwise be difficult or impossible to achieve.
This is like the previous lesson, but are the negatives.
Let's try and make these easy to understand.
You have made it! Now look at the rest of the lessons and see which ones you want to do.
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.
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
Let's break down matching of email addresses.
Regular Expressions (REGEX) - A Complete Guide. 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 expert. It is laid out logically so that you can incrementally build your regular expressions' knowledge. Essential Regex 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 Regular Expression 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.
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!
Are you looking to solve some or all of these issues in your day-today job?
Text search and manipulation: Regex can be used to search and manipulate text, including finding specific words or phrases, replacing text, and extracting data from a string.
Input validation: Regex is useful for validating user input in web forms or other applications. You can use Regex to ensure that user input meets certain requirements, such as a specific format or range of values.
Data parsing: Regex can be used to extract data from text files or other sources, such as logs, spreadsheets, or databases.
Web scraping: Regex is an essential tool for web scraping, allowing you to extract data from HTML or other markup languages.
Automated testing: Regex can be used to write automated tests for software applications, ensuring that the output of the application meets the desired format or requirements.
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!
What questions do we answer?
What is a Regular Expression (Regex)? A Regular Expression, or Regex, is a sequence of characters that defines a search pattern. It is a powerful tool for matching and manipulating text.
What is the syntax for writing Regex patterns? Regex patterns consist of a combination of characters and metacharacters that define the search pattern. The syntax for writing Regex patterns varies depending on the programming language or application.
What are metacharacters in Regex? Metacharacters are special characters that have a specific meaning in a Regex pattern. Examples of metacharacters include "^", "$", ".", "*", "+" and "?".
What are some common Regex use cases? Regex is commonly used for tasks such as validating user input, searching and replacing text, extracting data from text, and parsing log files.
What is the difference between a greedy and non-greedy Regex pattern? A greedy Regex pattern matches the longest possible substring that satisfies the pattern, while a non-greedy pattern matches the shortest possible substring that satisfies the pattern.
What is Regex Backtracking? Regex backtracking occurs when a Regex engine tries to match a pattern, but fails at some point, and then tries different combinations of the pattern until a match is found.
What is Regex Lookahead and Lookbehind? Regex Lookahead and Lookbehind are called lookaround, and they allow you to specify a pattern to match only if a certain condition is met ahead or behind the pattern.
What is Regex Character Class? Regex Character Class is a set of characters that can be used to match a single character from a given set of characters. For example, [a-z] matches any lowercase letter in the English alphabet.
What is Regex Quantifiers? Regex Quantifiers specify the number of times a character or a group of characters can be repeated in a pattern. Examples of quantifiers include "*", "+", "?" and "{m,n}".
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!
Don't just take our word for it - our students consistently give us high marks for our engaging content, expert instruction, and practical approach. Join us today and see why our course is the go-to resource for learning Regex!
5 Star - Easy to follow and understand. Most of the questions I write down to ask end up answered at some point in the video. - Nicholas Wilson
5 Star - Articulate and easy to follow. Well recorded with quality microphone. Content is well constructed and builds up knowledge steadily and logically from zero - Robin Roberts
5 Star - Paul is the best instructor I've ever had on any online course. If you want to learn Regex, this is a course that you must to finish. - Aleksandar Zivanovic
5 Star - This course definitely breaks down RegEx into very digestible pieces and I actually used lessons learned in the first section to solve a problem at work! I highly recommend this course to anyone looking to learn RegEx! - N. Home
5 Star - One of the most fantastic course you can take to get you started on RegEx!!!! - Edj Wright
5 Star - This was an excellent course! Paul explains things in a way that makes the subject easy to follow. All you need to do is just practice and apply what you learn, and you'll be on your way leveraging this powerful tool/skill! - Adam Araujo
5 Star - This is by far the best overview I have found on the internet for Regular Expressions. - Blue Echo
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
5 Star - Everything was explained well in this course, would recommend for a beginner. - B Ganesh
Whether you're a beginner looking to get started with Regular Expressions, or an experienced programmer looking to expand your skills, our course has something for everyone. Sign up today and take the first step toward mastering Regex!