Hello, in this python programming video, we are going to kick start off our reg x or regular expression section. So regex is essentially a way of checking if something equals something, something matches something or something is, you know, the same as something else. So it's basically a special think of a sequence of characters. That helps you naturally have points strains in strings. It's like really awesome. A really, really simple new when I first discovered this regular expressions, you can, oh my god, this is amazing.
Okay, the first of all, we're going to need to import a module. And it's already so that's already for regular expression. And in this video, we're just going to look at the match expression. So we have a different pattern equals ory compiles into the compile keyword. And now this is the pattern that we're going to be looking for. So if I were to type in E Ll this will become clear in a moment then if I were to print so for print the result of pattern dot match the word checking for a match on our pattern.
And if I specify some strings of hello world, for example, if I have one instance you might be thinking okay, it's in there. It's gonna match let but let's take a look see what we get. Okay, trying to stop it but two things working. Okay. stopped it now. Some do it pattern match hello world okay.
So, let me agree one non okay pattern does not match and the thing is what it does by default it goes to the first character and if district does not match the first character I know onwards, then you'll return false but we can do is put an optional position character and this was a start from this position. So one being the second position because remember stuff computers journey started zero. So, if I run this now, bigger non one boys playing the wrong place mentally in the match my back running again and this way There you go. We get a match. So it says it is matched. So e L is in side of it and you can access different pieces of information from our Mac.
So if you were to assign that to something like pattern so what I'll do I'll say result equals a copy this should be successful. And I'll put the print result dot one. Now just wait for this to successfully wrong okay, so no such group no such thing. Ah my bag This is meant for a different type of match. And this different type of match essentially now allow you to provide a regular expression. And this is, you know, this building on top of what we've already done.
So keep this code in mind this line of code in one of the Next, I'm going to explore the other more sort of advanced, you know, just server on MATCH function. There'll be a link in the description to help you, so feel free to check that out. Thanks for watching, and I look forward to seeing you in the next demo.