Before we begin using regular expressions inside Python, I want to make sure you understand what regular
expressions are in the general sense, because regular expressions are not only used with programming
languages, they are also used in other applications, such as word processing apps, for example,
Microsoft Word or Google Docs.
So in this video, I want to give you an example of how regular expressions would be used in a Google
document.
You don't need to do anything.
You can just watch this video.
You don't need to.
To do what I'm doing, just please follow me.
So let's say we have this text in a Google document, and this text is made of different chapters.
And let's say we want to count how many chapters we have, how many of these we have.
So chapter eight, Chapter nine, Chapter ten.
To do that, you would go to edit and go to find and replace.
And perhaps search for chapter.
Right.
And then we see that we have five of them, but there are three only here.
So this finds operation is not enough because it's not telling us the exact number of chapters here.
It is also counting that word chapter there and this word chapters here in the total number.
And that's where we get the help of regular expressions.
So regular expressions are integrated in word processing apps such as Google Docs, for example.
You see here you can check this box now match using regular expressions.
And then after chapter you make a space and then you write the regular expression with square brackets
open and close square brackets and right 0 to 9.
Now you'll see that we get three results and that part's here.
That is a regular expression.
So this was able to capture chapters together with the numbers.
So regular expressions are a language that lets you create patterns to locate texts.
So this language can be written inside other apps such as Google Docs, but it can also be written inside
Python, as you'll see in the next videos.
So in this case, this tells us to capture the shape, chapter and space and then any number from 0
to 9.
We'll talk about this more in depth in the lecture video so I'll not go deeper into explaining what
this means now.
So this was just to give you a general idea of what regular expressions are.
Of course, when you use them in Python, you are more powerful on what you can do.
The capabilities are immense.
The things you can do are infinite.
In Python.
You can analyze text and then you can display that text on a website.
You can send it by email, you can do anything.
So let's dive into Python and in the next videos where you must see regular expressions that are similar.