Advanced Expressions

4 minutes
Share the link to this page
Copied
  Completed
Time to advance our knowledge with super-duper advanced expressions to up or RegEx game.

Transcript

Hello, in this video, we are going to look at some advanced expressions. So till now Yes, we've used the matching search function, but the actual, you know, thought of pattern review, very simple, essentially just this doesn't match it, but we can go really complex into it. And we can prove within our match search and well out or the, you know, regex method. And that's what we're gonna be doing in this video. So we can get rid of all this, we still need the import our recent data as it is. So we're going to create a string called one.

And this is going to be equal to one Oh, well, awesome. Now, having result variable, which will determine if our sort of regex search is, you know, successful so already, so this using the reg x objects already. So you could do this with match and one's gonna use it. But this takes Free parameters. So the first parameter is essentially the pattern that you want to match to. The next parameter is the string date you know your check inside.

Final parameter is the flags. So let's have a look at the pattern. So the pattern weather moving on. What we're going to be doing is essentially checking if, like the word world exists and get the words before and after. So question mark, time to close the quotation marks now specify the string you want to search. And finally, the flags have already doctor you separate all flags by a vertical line the pipe party.pi.

So what are the dot m and r dot exactly? Do so M is multi line, so it does multi line matching. And the AI is basically does case insensitive matching. So that's what they do. And also you can add more on them to provide a link to this video which will cover all of the different ways you can form patterns and all of the different ways that you can form your flags. We're going to cover the basics, and the link will really help you go beyond that.

But if you understand what we're doing, yeah, you're all good to go. I don't know why it's giving me this error, because I've tested this zombie and I, but I've tested it before and he was giving me an error there. I think it's just this idea because you'll see he will work. So if, if you use the same ID as made then you might get this error, just ignore the first of all, we are going to check if the result is valid. If it isn't So let's do this code First we'll do No, no. And if it is valuable, first of all, we're going to print results dot group.

So this is the method and this will print essentially, all of this and copy and paste this twice. And if it isn't, for the result proof for one, and for two, and you'll see what happens. So let's click Run successful. So it's success voices. HelloWorld is awesome. Hello and is.

So again, we was searching for the word world, which we found. We will search for anything before and after. And if he was in this format, then we were able to get the two words taxi for advanced expressions are not much more to it than that. Just experiment using what we've covered here. In the previous video, and in the links that are provided along with this video to you know, create, you know different types of expression, but really that's it for that expression. We'll be using these a lot more and you know, slightly different forms of them.

So feel free to definitely recommend going over the links provided because we'll be using some more some more patterns in our future regular expression videos. Thanks for watching, and I look forward to seeing you in the next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.