Complete Regular Expressions From Beginner To Expert for Web Development | Sandeep Kumar | Skillshare

Complete Regular Expressions From Beginner To Expert for Web Development

Sandeep Kumar, CEO - Trainool, IT Consultant/Coach

Complete Regular Expressions From Beginner To Expert for Web Development

Sandeep Kumar, CEO - Trainool, IT Consultant/Coach

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
45 Lessons (4h 22m)
    • 1. Introduction to Regular Expressions

      8:32
    • 2. Tools used in this course

      9:24
    • 3. Basic Syntax of Regular Expressions

      5:25
    • 4. What are Character Literals?

      7:30
    • 5. Character classes - Part 1

      10:30
    • 6. Character classes - Part 2

      2:36
    • 7. Character Range

      12:21
    • 8. Real Life Example of the Regular Expressions in a Web Page

      7:07
    • 9. Negation Character

      4:48
    • 10. What are Meta Characters

      5:06
    • 11. Wild Card Meta character - Part 1

      8:50
    • 12. Wild Card Meta character - Part 2

      2:21
    • 13. Escaping Meta characters

      4:29
    • 14. Predefined Character Classes List 1 - Part 1

      3:46
    • 15. Predefined Character Classes List 1 - Part 2

      5:36
    • 16. Predefined Character Classes List 1 - Part 2

      3:31
    • 17. Predefined character classes about white space

      3:41
    • 18. Predefined character classes List 2

      4:55
    • 19. What are Anchors

      10:22
    • 20. Examples of Anchors

      3:35
    • 21. Word Boundary

      6:49
    • 22. What are Quantifiers

      5:43
    • 23. Question Mark Quantifier

      3:10
    • 24. Exercise on Question Quantifier

      3:11
    • 25. Asterisk Quantifier

      5:05
    • 26. Plus Quantifier

      3:14
    • 27. Quantifier to limit the range - Part 1

      3:48
    • 28. Quantifier to limit the range - Part 2

      2:24
    • 29. Quantifier to limit the range - Part 2

      3:10
    • 30. Greedy Quantifiers

      9:00
    • 31. Lazy Quantifiers

      2:55
    • 32. Alternative of Lazy Quantifier

      6:24
    • 33. Greedy Vs Lazy Quantifier

      7:19
    • 34. What are Groups

      2:24
    • 35. Examples of Groups - Part 1

      6:12
    • 36. Examples of Groups - Part 2

      6:55
    • 37. Numbering and Back Referencing

      11:04
    • 38. Non Capturing Groups

      3:49
    • 39. Alternation in Groups

      4:45
    • 40. Nesting of Groups or Alternation

      6:10
    • 41. Positive Lookahead Assertion-Part 1

      12:12
    • 42. Positive Lookahead Assertion-Part 2

      6:12
    • 43. Positive Lookbehind assertion

      6:52
    • 44. Negative Lookahead Assertion-Part 1

      2:43
    • 45. Negative Lookbehind Assertion

      5:36
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

40

Students

--

Projects

About This Class

'This Course covers Regular expressions with real-time examples and Project which is a real-world application'

'Regular Expressions are also called as Regex or RegexP'

"Welcome to the Most In-Depth and Quality Content Course of Regular Expression (REGEX or RegexP) from a Expert"

  • The Course is full of quality content which you will not find anywhere in the Internet

  • Learn from an Expert who has a passion of training

  • The Course covers Real Training with the aim to provide knowledge which is similar to corporate training.

==========================================================================================

Join this course which is the best "Regular Expression" course . I will show all the syntax of Regular Expressions with multiple examples along the way!!!

Want to master the Regular Expressions(REGEX) with no previous coding experience and are confused about joining which course on Regular Expressions(REGEX) to understand from the basics to an advanced level?

You have come to the right place. This is the most complete and in-depth Course on Regular Expressions(REGEX) in Skillshare.

If you do not believe me, Please have a look at the Course content carefully and ask a few questions from yourself?

  • Is the Course taught by a real-time expert? I have more than 15  years of experience as an Instructor and more than 5 years of experience on Regular Expressions(REGEX). I firmly believe that if an Instructor does not have a good experience, he/she will flood the course with poor content.

  • Is the Course content clear and Precise? I bet you will not get a better Course content than this. Please have a look at all the courses and choose wisely.

  • Will the Course be In-depth? The Course covers In-Depth knowledge of Regular Expressions(REGEX). The amount of Knowledge which is covered in this course is great.

  • How is the quality of the Content? In Regular Expressions(REGEX), there is a lot of low-quality content which is spread throughout the internet. Be wise in choosing the course which has the best content which is presented in a good way to provide maximum output.

  • The course assumes no prior knowledge on Regular Expressions(REGEX) and teaches you from scratch to advanced level

Do you want to start on Regular Expressions(REGEX) but have no experience on Regular Expressions(REGEX)? 
If you have some prior knowledge on Regular Expressions(REGEX) or if are a complete fresher, you are at the right place. The Course teaches you, complete Regular Expression(REGEX) right from Scratch to Advanced level.

There’s no risk involved in taking this Course!
I am sure that this is the best course on REGEX and you can compare the content which is provided in this course against any Regular Expressions (REGEX) Course and I guarantee you that you will not get such a good structured content anywhere.

What if you are stuck?

I personally answer all the questions which are asked here. If you are stuck anywhere, ask a question or you can message me directly and I will answer all your doubts.

Are you getting updated content?

Yes, I keep updating the content always to make sure, I provide all the information to my students.

Once you enroll for this course-

1) Understand what are Regular Expressions

2) Master the literal characters in Regular Expressions.

3) Master the Character ranges in Regex world.

4) Numerous real-time examples have been shown to make learning better.
5) Students will be able to code the Regular Expressions for any programming language.

6) Create a strong foundation for Regex.

7) You understand how to analyze the Regular Expressions.

8) All special characters in Regular expressions are covered in detail

Meet Your Teacher

Teacher Profile Image

Sandeep Kumar

CEO - Trainool, IT Consultant/Coach

Teacher

My name is Sandeep Kumar. I am the founder of a Trainool. I have more than 10 years of Experience in Mainframe & more than 5 years of Experience in Website Design and Development.

I have worked as an Employee for some big Fortune 500 companies. I even worked for a Fortune number 1 company for more than 3 years.

I am a believer in Scrum and created some of the projects from Scratch.

I own my own website www.trainool.com

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Introduction to Regular Expressions: Hi. My time is finally here and this video. Listen, we will understand about what? Our regular expressions. Where do we use regular expressions, or why don't we use regular expressions? And we will also see how we can use regular expections. Okay, so what are regular expressions? So basically, regular expressions are sequence off characters that define a search pattern. This helps to validate a city's off characters for matching. So regular expressions basically helps to describe the complex pattern in text. And if you use a regular expression, you can search a particular string. You concert for a particular pattern. You can replace a text data. You can extract particular data or you can even modify the data. Right and regular expections are also called as projects, or sometimes it is also called as project speed. Now, why do you need to learn regular expressions and where regular expressions are used for regular expressions are used in most off the modern programming languages like Java. HTML forms script, be it be bite on Paul Robi, etcetera, saluting regular expressions. You can validate a particular field in a form or multiple feels in a form. Suppose you have designed a particular sign up or a log in page in a particular website using any programming languages. For example, if you have used PHP or you have used JavaScript or fight on or even a simple HTML form, then we can validate the input which user has provided. So we can also accept the user input. Or we can reject the user input based on the validation performed by our regular expections . For example, consider this case, for example. Suppose have just given my first name, for example, Sandy. And let's give my last name as Kamar and suppose you have given user name. And here it gives a hint that you can use little's numbers and periods and suppose you have just given some user name. For example. I've just given a random text, and I have just given an person or percentile or you have just given has symbol and support that I have given any password. Okay, and if you just give next you know this year that it says sorry, only letters, numbers and periods are allowed. So basically, this is the validation which is done on the input which I have provided. Okay, so you can basically do the same thing using regular expression. So using regular expecting, you can validate the data, which is provided by a particular user on based on the valuation off the critics or regular expression, a particular warning can be displayed to the user. Okay, so let us go back to the boat. You could also use regular expression to extract certain parts off strings, which are also referred as sub string. In one of my projects, I used to extract the filing as substance from multiple strings, using regular expressions on bull programming. Language on. Please note that Bull uses regular expressions excessively and using regular expression. I used to validate the patterns of the file names and based on the pattern off the filings , I used to send these five tips to particular destination or a particle a folder. Now consider that your job is to clean the files, for example, you have to read multiple fights, say, 5200 files, and each off these files contains several of thousands off your ALOF websites. Or suppose it has multiple phone numbers or email address or date of birth, etcetera on. Please know that all of these follow a particular pattern, and we have to find that particular pattern. And in some cases you are also required to replace those strengths as well. No, If you try to do the same work manually, you cannot do it. I mean, you can do it, but it is not as effective as it will be done using regular expressions because, first of all, it will be a lot off manual effort. It will be time consuming, and it is inefficient method. So the fine might not be a formatted file as well. And the fight can have special fuse, which might be separated by a comma or tabs or space and so on, right? So in this case, it is best to use regular expressions to describe the search pattern. We can also use regular expressions for lot for other purposes, including databases or command line as well. Know almost all the programming languages or database our command lines. You, the similar types off Centex off regular expressions on the regular expressions, which you learned in this particular course will be compatible. But all the programming languages, databases or command lines, of course, minor modifications are required. As for the language, but they are very minor changes. So the Syntex off regular expressions, remains almost same in all the programming languages with little modification here and there. Now, the next important question is how regular expressions are used. Or you can simply say that how regular expression is created. So here you see that this is one example off simple regular expression. Actually, it is not simple for those who does not know anything about regular expression. But believe me, once you go further in the course, you'll see that this is pretty simple. Regular expression and simple regular expression is used to match the word regular expression, our projects or projects be okay, So let me just show you. So if I just goto this particular website that is rejects 11 dot com here have written my text fatten. Actually, we will discuss about this particular website in the upcoming video lessons. But if you notice here have returned my pattern here. Okay, so this is the pattern which I have written here. And if you see here, it has massed nine part of listings. So here you see that it has nine matches so it can match regular expressions in smaller case. Regular expressions in mixed case realer expressions in entire capital letters. And here you see that it is matching regular expression. There is no s after this end, right? And it can also maps red ICS in small case or projects and mixed case. Okay. And it is also able to match this red XP. In mixed cases, our projects be in smaller keys, Okay? And of course, it will also met with XP in Capital s will. For example, if I just write projects be you see that it has matched this as well. But this plot matched our or HTML or this particular texting, for example. Hi. This is the first listen. So this particular regular expression is used to match these particular things, right? So, in fact, the scores is all about how we can could regular expressions, which is a sort off universal, regular expressions that can be used in any language. So I will start from the basic, and then I'll move to some more advanced topics as well. All right, Thanks a lot. And I'm sure that you got a basic introduction on regular expression. Please take your and I'll see you in the next. We do listen by 2. Tools used in this course: Hello, everyone and welcome. First of all, let us see what are the tools which we are going to use in this sport Clerk owes. So if you just go to your browser and type projects distant to see lot off links, for example, the 1st 1 is Red X 11 dot com. Then the next one we have is rejects tester dot com. We do have rejects our dot com and so on. So if I just go to this 1st 1 that IHS rejects 11 dot com here, you can see that this is my Red X 11 dot com and this is the most powerful and most well known online Red X distance, and we will be using this project's tester throughout the schools. And if you just see, we also have this Reddick's art dot com. This is also a very good tester, So if you like this, then please go ahead and you can use this as well. And we also have this predicts, tested dot com. So few people run their regular expressions in this online editor as well. OK, but we're going to stick with this. Reddick's 11 dot com, and here you have to write your regular expression. So this is the area where you have to write your regular expression, and this is the Texas stink. So whatever text ring for which you have to write a regular expression, we're right here on. You have to write the text string here, and you can see here. There's a lot of flavors. For example, this regular expression you can run through PHP or JavaScript or fight on our Golan. Now, whatever regular expressions we are going to learn in the schools will be moralists compatible with all of these flavors. For example, the same regular expression will run fine in PHP as well as JavaScript or by tone or going or full are, you know, even HTML or Java asthma. Of course, there will be some minor changes, but apart from those miners changes, you can still use the same regular expression, which we will learn in the schools throat. Any programming languages. Okay, and suppose you have written a pattern here and your Internet connection goes off for any political reason, and in that case, if you want to work on offering red X tester or offline regular expression text editor. Then you can just go toe Adam. Dr Isles. Okay, so you can just search in Google for just give you Adam Adam Next. Eddie, you see that you'll get this link, OK? That is a city ps. And then it is atom not I hope so. If you just come here based on your operating system, you can just download it. For example, in my kids are windows, so I have just in Saugus Atom text editor. OK, this is an open source and of course, it is free as well, So you can easily use this without any issues. If you're facing in issues with your online text editor, that is projects for no one. So let me show you how my at a text editor looks like. So here. You see that once you install this atom text leader in your next stop, you'll get a welcome screen. Okay, so just close that welcome screen. If you want to create a new fight, you can just go there and click on new file under this file. Okay? And here, if you see, I've just written some piece off information and form off text right. So either it can be a per case, for example, which is in upper case here. You can see that these two words are in upper case. Then we have a dark and here you can see that this is my peerless. So basically, this is I practice and the one here. If you see this highlighted text, this is actually regular expression. Which algorithm? Now? First, let me just show you one thing. Let me just delete this and normally it will be like this. Ok? And it will be I get close panel. Okay, So basically wants to come to this new fight, it will be like a blank fight. And suppose we have returned some text than what you have to do is you have to just goto this find and under this find you can see that you have this fine in buffer or you have this replace in before. Okay, so you just have to click on this finding before and you get this particular panel right? Are the other option is you can just give control f if you're working in windows and I just gave control. F you see? That gets me the same battle. Now the most important thing here is you can see that there is an option here that is docked star. Okay. And if you just bring your guts or here you see is used red ICS. So you have to click on this in order to you regular expressions, okay. And I cant beside that. You see that? It says mass keys. So by default, regular expressions are is sensitive. That is, there is a difference between capital and small pebbles. So just enable this as well. And whatever regular expressions you have to write, you have to write in this particular area. You can see here it is saying that fine in current before So for example, let me just based the previous regular expressions which was returned here. So you see here that this is glad expression. And of course, at this point of time, since you don't know what is regular expression and how this looks like, so it might appear a sort off scary, do you? But once we move further in the schools, you will see that it is easy and you will see that you can easily right the regular expressions for this I p Enis. So basically, once you give enter here, you see that it gives one phone, and it has highlighted this particular text. So you can either call this a text, or you can just call it like a group off numbers. So this is highlighted by this regular expressions. So if I just removed this, they just removed this. You see that? Now it is not related, but once I have given this regular expression, you see that it is highlighted. That means this particular regular expressions has fault. One next batter. You can also replace this particular regular expression with some other value. For example, suppose you want to replace this with some other value. For example, just for the sake of example, Let's replace this with ABC. Just give enter and you see that now it is replaced at ABC, right? So at this point, I don't want to replace this with ABC, so obviously moving, and what I'll do is I'll just give controls it so that I get my I p address and let me just delete disappeared us here. Okay. Suppose I want to just match high. You can see that I have this high here, right? So if I just want to match high, you see that it gives me no reserve At this point, I think once we give enter, you see that it has given me one funk. So it masked this height? No, if I just give I in small, for example, Previously we give at in capital litter. And now if I'm giving that I in small later. If I just get Pinker, you see that it has not matched this particular high and stood off this. It has masked high in this particular work status. Ph Yes. Similarly, it has highlighted high from here. Hi from here. High here, here, etcetera. Right, So you can see that regular expressions are very powerful. So if you just write simple regular expressions, for example, in this case, if I have just written high is able to match this high and you've been also right at a glad expression which might appear complicated at first. But once you move further in the course, you see that those are very easy. So if I just write this regular expression, you see that this is master Siberia's has that right? so you can even Matt a very simple word, and you can also match very powerful pattern as well probed the schools. We will be using this rejects 11 dot com. And of course, you can also use Atom as an offline projects tester as well. But we are going to stick with Red X 11 dot com at this point in this coast. So thanks for draining. And I'll see you in the next. We do listen, take care and by 3. Basic Syntax of Regular Expressions: hello and welcome. And this we do. Listen, we're going to understand about the syntax off regular expressions. Regular expressions are the sequence off patterns are placed inside to forward slices. So here you can see that I have one for was less on here. And then we have one folds left as well, and we have to surround our regular expression between these 24 slices. So let us take one example. So if I just come to this projects 11 dot com, let me write few Shing's are few dicks, so I just right here, rejects is fun. Look, quit and suppose I want to match medics. So here you can see that this Reddick's engine has already placed a photo. It's less here and for looks less and the end so you don't have to place two forwards classes again. What? You have to do it. You have to write your pattern between these two false less is so Suppose who want to match the word medics you can simply right here r E g e x, and you see that it has given one match right? Similarly, if I just say here, for example, Reg Exe von Neumann. And if I just want to met 11 I can just right run one. Right. And this has mass. This number London one inside this string right now. Please don't hear that we have this particular flag. Okay, so this flag is also guard as modifier are moors okay? If you just click here, you see that you have different rejects flags and by default projects 11 dot com will have global mood and multilane more. First on what is guilty. So basically, we're having a complete lesson on these modifiers. But at this point, I'll just explain you what is global mood at my d language? So first, let us understand what is building more possibles. You have written a regular expression. For example. I've just returned you rejects 1 to 1. And again, if I just write 101 and you see that if I've given the pattern here as 10 it has masked 10 in here in the second late. And also when you're one in the third line as well. But if we just switch off this global war, that means if we just disable this global mood you see that it has massed on Lee. This particular match that is 101 That means it will only look for the first match on once it has got the first minute, the criteria is fulfilled and it is not going to look for for the matches. And look here. If I just enable this global flak, you can see that No, we have two matches here and the first match here and the second match here is high right now. What is this Marty Lane would. So basically, multilane mode is not very important at this point of time. But since critics 11 dot com enables this month deadline would by default, let me just give a brief introduction about this multilane mood. Once we move forward in the school, we will see that we have a carrot symbol on dollars symbol. So basically, this carrot symbol and this dollar symbol are part off angles and anchors are used to Matt a particular position. The carrot symbol simply batches the position before the first character off a line. And this dollar symbol matters after the last character off line arching. Okay, So please notice that by default, this global mood and this multi line moved our neighbor and red x 11 dot com And at this point, we're not going to disable it. So basically, this multilane mood is important when we are learning about anchors. So at this point, until we goto anchor section, either you can disable it or you can enable it. It is up to you. It's a lot of back are reserved. But once we goto a section on anchors, this plays an important role. But please let this global more enable because if you want to match everything, not only the first match then please enables global more. Right? So this is just a basic introduction off the Syntex. Off regular expression, we will start learning more about regular expression from the next video. Listen, so thank for training and I'll see you in the next video. Listen 4. What are Character Literals?: Hey, people, welcome to the section in this section we will understand about character literal. So, basically, what is character literal? So little characters are characters, which does not have any special meaning. Rather, they're the simplest form. Off characters are patterns. You can also think off little characters as the most basic literal expressions. Now let us understand, in my credible what is a character you can say that a character is any letter, number of space or punctuation mark or any other symbol that you can type on a computer. And if you know any other programming languages, we know that character symbols can be represented inside a single code. For example, if I just say, see, and if I just put it inside a Ostroff or a single cord, you can see that this is a character. So this is a character literal in other programming languages. But this is not true in case off regular expressions. Okay, in case off regular expressions, character symbols are not represented using a single common. So basically, character trolls in regular expressions are the most simplest on the most basic little's, and you have to consider this as whatever they appear. For example, if I just go here if I just write, he okay, So Gaiman's. Similarly, if I write Apple, it means Apple. If I write 1 to 3, that means it has 123 Okay, if I just like it is so whatever the literal meaning off that particular character we have the same thing you can consider as character. Little's okay, if I just write close, that means equals Okay, We should not consider this equal as assignment operator or something else. Because if you consider this equals as assignment operator, that means you're considering that it is having a special meaning. But if you don't know what is exactly assignment operator, and just think about this equals so basically equals is equals. True is true. 123123 If I rage our so gentlemen's jabber fire right full, that principle is bull right now. Continue a few example. I suppose I have here have both Okay. And I just want to match for example, after then you see that this apple is matching here. Okay, now, this is not exactly matching apples. You see? Here it matches apple here, okay? And s is left out. Similarly, if I just right here, for example, phrases right through. So if I type match through if I just give the pattern as two you see that it has given me one match. Right? So this is how you can think off character? Little's No. Let us take a string. For example, if I just say I know. All right, Uh, I know. No. Suppose I give my back down this? You see that it has Matt Lauer here, but it has not matched Java, which is here because this change isn't capital later. So by default, regular expression is kids sensitive. Now, if you just want to make the regular expression as keys insensitive, then what you can do here is you can go here and you have this option that is insensitive. So if you just click on this insensitive flag, you see that now it does match. That is discharge as well as this job. Right? So, for the time being, let's make this half sensitive. Okay, so I just removed the flat similarly, for just right here. So you can see that it has given two matches one here and one here okay. Similarly, it is just Brutus and I just give you 12345 and my search pattern. If I just give one to you, see that it has massed Oneto. Similarly, if I just give 123 space for five to see that it has messed this one too. And a state of 45 Let's make us one toe. So you see that first it has massed this 12 and then it has messed this one toe actual. Now let us delete this. That's make it does freely and just give my search pattern as treat Lee, you see that it is a full match If I just make 333 You see that it has messed this strictly but not history, because it is not having a three again after this tree. Hi. So So if I just give you three, you see that it is having two matches, right? Similarly, if I just give 333 t three you see that it has to matters that is district three on the next 33 on it has left out the street. Now some of you might argue that why? It has not passed this treaty on this treaty, that's all. Now, the simple reason for this is regular expressions start searching from left to right. Okay, so first it has messed this three tree on a document. So it moves forward and again searches 33 and it has fallen. Now it moves forward and it tries to match tree tree again. But here we have only three, so it is not able to match. Right? So take the little characters the way they are. So I hope the idea is very clear about little characters. So this is just the starting point off regular expressions. You can see that the character Littles are very simple. In the same way, the entire coast will be very simple. Please be motivated and I'll see you in the next video. Listen, so happy learning and take care 5. Character classes - Part 1: Hello and welcome back. One important topic which comes to my mind right now is character classes to begin. But the character classes are enclosed in square brackets. For example, you can see that this is a square bracket that is the opening off square record. And this is the end off square bracket, right? And whatever you right inside this his expression or the pattern. And this is card is a character class. Okay, so let us take an example. Suppose I have a, B, c, D and E and I have to match either A or B or C for I want to match all e b and C. Then what I can do is I can just give this cloud of record and I'll just give a and let's close this squad record. So if you give a that mills, it matters. A. If I just give B, that means either match A or B or you can match both. So in this case, it has amassed a as well. Let's be now. Please know that it does not matter. See the or so whatever you have given inside this square record, it will match those similarly if I just want to, Matt. See, also, I can just give ABC, right? No, let me just they would be. And if I just give a c You see that it has given me two matches. So it has mastered this A. And it has matched this. See? Now suppose have few words, for example. Sorry. Then we have that order. City lab are mad. And suppose I want toe match charred that lead. And I don't want to match mad than what I can do is I can just give you Yes, the hell and then I'll just give you 80. Okay, That means the first letter can be either s or it can be d or l and followed by 80. So 80 is mandatory. And s r D r l should be in the first position. So you see that it has given me three matches and it has matched sad Dad, that lad on please hold that it does not messed this man. If I just give, I m Also you can see that it has messed this mad also. Now this order is not important. For example, let's delete this M and what I'll do is just give l here and I really this l from here. So still, you see that it has given me three matches. So it has massed this sad dad and learned Now we can even take numbers inside this, for example. Let me just delete this. Say, 123456 And I just want to match se 14 And you see here that it has messed this one and four . Similarly, for example, it's have number like four country. And if you just give one for three, it'll match the 1st 1 and the 2nd 1 Please know that it has not messed this 897 Now, to be more precise, exchange it toe bigotry. And still you see that it has not messed this 8 to 3. The only reason because it has not messed 8 to 3 is you have given either it can be won or for So if you just give it you see that it has given three matches and it has massed 1234 to 3 and 8 to 3 as well. No. Suppose I want to match all the woman's. So what? I can do is suppose I have a strength or a word. For example, e i for you. Okay. And they just delete this. So I want to match this. So what I can do is I'll just give you a key and you see that it has messed this work right on. If you give any other letters apart from this, it will not match that. So let's give hell. You can see that it has not passed that. So we have understood how this character class works. Let us take an exercise. Not suppose you have words with salt similar but have completely different meanings. For example, say you have as he and you have us e right on it refers to leave this and suppose I want to capture these words. For example, the pronunciation for the sea and the sea is same, but the meaning is different. So my requirement is I want to capture the word which starts with S E. On. It ends with either e r. K. So what I do is I just come here and I'll just give SD and here I'll give either eight or so You see that it has massed to places that is the 1st 4 and the 2nd 1 on. Please know that we cannot give something like this. So if you just try to give, like as he and then a please know that this is a wrong match. So basically, what it will do is it will just check for either s A or e. And here we have E Now let us take and exercise. So let me first believe this. And now I'll give a bathroom to you and you have to give the best string. OK, so please try on your system, so I'll just give you a B c b the blue way, and then I'll just give 80. No, you're right. All the best string which matches this pattern. So please pause this video and try in your system. I hope all of you are able to do it. So let me just give the matching best strength. So it will be either ved or it can be c d are creepy or the blue et our white hickey. Right? So these are all the matching patterns, and if you just give any other, for example Katie, do you see that it has not masters. Just give It has not missed. Similarly, if I just give already, it has not matched this. Right? So these are all the magic walls and these are all on matching ones right now, whenever you're working on regular expression at start. What I would also suggest is to read the question very carefully, no matter how simple it is. So at start, please do an analysis. It might appear silly at start, but believe me, when you actually write, you learn a lot because on your senses are activated when you're right and you redeem or what you have learned now where it was the question I suppose I have this spring and I want to create a regular expression for this. Then first, let me just delete this regular expression, and what I'll do is first. I'll do my analysis. So I'll just right here on dialysis and I can see that the string is three characters. So I just said on this three characters No, please know that it is not important that you have to write in a very structurally it is only for you for that once you right. You understand more. Okay. And the second point, what I can do is I can just say like it starts with the either be off C R p or the blue or way. So I'll just say B c b double away, right? And you can see that Miss Lind His That means either It will match be so if it matches be, the length has one. If it matters, see the length is one. If it is Mattis B or W or write the length is always one. So I have just written that length is one and I'll just write it always. So this lamp is always one and the third point Martin sees it depends. Okay, now, once ill done your analysis it is very simple to write your pattern. Now you see that it has started with a B or C or B or the blue or way right, So it is very simple. You can just come here and you can just say we see the blue way right on. If you just say it is three characters, total ink on this one is always one land right, and it ends with E. T. So you just have to give right now. You might say that if you're right, it is a waste of time. But believe me, I'd start if you just write it down like this later. Point of time. You'll love whatever you're doing in your regular expression because it will make your regular expression learning very easy. All right, if you enjoyed this, Listen, give sometimes for practice, because practice makes a man perfect. Thank you. 6. Character classes - Part 2: Hello and welcome back in the last. Listen, we have understood how we can match either off the characters. No, If I just take that example forward, suppose I add another would you can just add VB peaking. Okay, so you see here that it has massed this bt and it has also mess this bt from this What? No. In few cases, you only want to match this bt not sub string from that mainstream. So you see that this b e t is a sub string off this BBT, right? So what you can do is you can just give you a backslaps and then be so This is called over boundary. Okay, so what boundary is the boundary between the world and it? Non word character. So you see that in this case it has not matched this baby et No. Again, if I just give b ds, you see that it has given six matches That is that mass dis Bt that it has managed this bt from this Becks and then Bt c e t w t 80. Right now if I don't want to match this bp from this bets as well What I can do it. I will just give backs less and then be so again, I have given a word boundary after this. T So you see that it has not mess this BTS at this baby. And apart from that, it has messed everything that is bit set, pet parrot. And yet so you see here it has five matches. Now you can see that match information here as well. Okay, so if I just click you you see that it has given me the exact match. Okay. And here you can also look for explanation in case you're in doubt. Okay, so I just wanted to clear it out because few off you might get this doubt. Anyways, we will cover the vote boundary and anchors in detail once the schools will move further. And at this moment, I just wanted to give a brief explanation about this word boundary in the next Listen, we will understand about negation, so tell them Take care 7. Character Range: Hi there. And welcome back. And this regionalism, we will create regular expressions for a character which falls in a part of chlorine. So let's go directly to the board. No, for matching a specific range. We used a hyphen inside this credit record, for example. Suppose we have this square, Beckett. Okay, so this is the starting. And this is the end off square record. No, we put a hyphen in between on Dhere. We have to give their starting and here I have to give the And so what I meant is support. We have a shrink like all right, This I just And I want to match all the characters which false between e toe. Then what I can do is I can just give e hyphen on. See that everything which is present in between e to l is matched. Right? So here you see that Etch is between eat well and then we have I. And again this is masters. I this I then we have Then we have e than I anti. So it will not match any other value apart from this range. Okay, Now, suppose I want to match all the alphabet which are in a smaller later. So what I can do is I just give you a hyphen. Said so You see that it has mass everything. Right now if I just give you 123 or percentile our caps, you see that it will not match those. It will only match all the small lucky's alphabets, right? Similarly, if I want to match all the ah packets off of it, I have to give your capital a and capital said so if I just have any puppies like if you just see, it will match all the upper case letters. So here that masters high. And this TG it isn't a pockets, so it has matched this as well. You can also match numbers for example Say I want to match between tree toe eat. So you see that it has match this tree right on. It has not best anything. For example, one or two, it has not mess. Similarly, it has not mask anything in the Slater's on. It has not messed these symbols for example percent I or had symbol. Now I want to match. All the numbers are all the numeric letters which are present in my file. Then what I can do is I can just give here procedural two plain and you see that it has massed all the numeric letters. So if I just do any numbers, you see that it has messed everything. Right? So here, you see, that has given 11 matches. So it has mass this one on then all the numbers here and here and here and again. It has magic. This as well? No. Suppose I want to match all numbers along with all the small case alphabets. So what I can do is I can simply give here he does that and then zero to my So you see that it has massed all the small cast letters and all the numbers as well. Similarly, if I just want to match all the upper case letters along with numbers, what I can do is capitally Rifle capital said so. You see that it will match all the upper case letters along with numbers. Right? So it doesn't match this chain and then ddg So these are in capital letters and it has mass the numbers as well. I will say I want to match all the alphabets, which are in smaller guest letters as well as an upper case letters. So what I can do is I can simply give okay, hyphen in small case. And then we can give a hyphen set in capitals and we can give zero tonight so it will match all the letters which are in smaller litter or capital letters along with the numbers. And you see that the other symbols, for example percentile are this hat is not captured? No. Let us take a small exercise. Suppose we have five employees who joined in an organization and we give a particular employee I d tow them, for example. Let's say if you have in Blank Lynn, I do Complying three and Blake Faith. Now what you have to do is you have to write a regular expression toe only match imply one imply to and imply three. So we have to mass still imply three, and we have to exclude imply for at imply five. So please pause this video and right, irregular expression for this. I hope all if you are able to do this, so what I'll do is I'll just give e. M. P and After that I will just give 1-3 So you see that it has captured imply one imply to an in flight three and it has not matched and play for and employ five. Now take another exercise. So first we need this and what will do? Just leave this pattern as well. And I suppose I have some words. For example, I have a And let me just give me and here just give c and again here let me just give t on I just can't catch And here they give I And here let me just see if x right And and let me also give some other random words for example Now suppose I want to capture these three words Okay, so I have to write a regular expression to match Onley these three words So let me just put a divider here. So these are all the matching words and these are not matching words. So can you please go ahead and write in a regular expression for this? All right, so it is very simple. You just have to give Hey, do you see? And then we have to just give g do I Right? And again we have to give X two is that you can see that it has matched all these three. So we have a GX, be it Wait and see. I said which are matching and these are all the words which are not matching. Right? So this is my pattern now. It is very important to note that we have to give a smaller value at the starting position and the higher value at the end petition. So what I meant is you cannot give you, like, see under a okay. You cannot give like this. So you see that here it gives the batter better. So you have to always give a smaller value here and a larger value at end. Just change it. Just give a right. So basically we should know the value off our habits, our numbers in terms off mathematical index. So what I meant is suppose we have capital K. The index off this capitally is 65. Similarly, we have capital d. The index off this is 66. And if you keep on adding one, you get, I didn't capital debt on the index for this capital. That is my Similarly, if I take the index off small later A. So if I just give small alphabet a the index off this is 97. Similarly, for small letter B, the index is 98 and for small litter, Zack, the index is 1 22 Now people take the index off numbers as well. So if you just take the numbers, Zito is having an index off 48. Similarly, if you just give the index off one it this what d night? And if I just take the index off night, it is 57 and this is very important. So you see that the numbers are having lower index. Then you have capital letters and all the small letters are having index value, which is more. That means if I just come here, I just deleted reading. And if you see, we can write capitally hyphen Smalley. So this is fine. So it will match all the letters from Capital E Capital. That and then small letter e. So you see here it has massed a B C and then small literary, but you cannot write like small letter g and then capital a. So here you see that gives a pattern. Er similarly, see, we can write a tow, Small said. That means capture all the capital letters and all the small letters so you don't have to write separately like like capital, a capital Ted. And it's for a tow small again. So instead of fighting like this, we can simply right capitally and then give a hyphen. And then small said so both housing. But you cannot write like small. Later, he and then Capital said, So this will be wrong. Okay, see here it gives a bad owner right? And that is the simple reason I have given this index value. So most off you are aware off this index value. But in case some off, you are not aware of this mathematical index value. Please, no debt. The numbers are having the lowest index value, starting from 48 to 57 followed by a bucket Slater's that is from 65 to 90. And then a smaller case letters are having index value from 97 toe 1 22 All right, we have taken a lot off examples and this matching rains, and I'm sure this we do listen, will help you a lot. Thank you. And take care 8. Real Life Example of the Regular Expressions in a Web Page: height. Let us take a real life example off regular expression. So basically here, I'm using a HTML form. Okay, so basically what? I have done it. I've just created a particular STM ill filed with the name pattern dot That's demon. Okay. And if you see here, this is my html Palm Beach. Okay, so I've just created this in a plane note pad file on Dhere. If you just come down, you can see that I have a back down attribute. Okay, so this pattern attribute in esteem ill uses regular expressions. Okay, So if you just see after this back and equals, we have inverted comma, and then we have just given a regular expression. So this is my regular expression with sees opening off school record. And I've just given a particular range. That is capital a capital. That and I have just closed this particular regular expression using closing off this scrap record. No, in patent attributes in a stammel, you don't have to place a force less at the end or forwards less at the beginning. Ok, so by default, this back and attributes already places one forwards less at the start and 14 slash at the end. Okay, so let me just remove this. And if you notice here, this is a regular expression. And once you run this particular a stable file for what I'll do is let me just double click here. And if I just run this estimate file you see here that it says right, your regular expressions. Okay, so basically have just given here that right? You're a glut expression, okay? And then inside this particular form, I have just given prove that you are not at work. So this text will appear here that prove that you're not a robot and again enter a single English capital letter. So this is a hint which is provided by the user. Okay, So if I just come here you see that I have just given a warning. My says here. Okay. So, basically, I'm not going to teach at Stamen in the schools. My only intention is to show that the pattern attribute, which is used in HTML, uses regular expressions. Okay, on, if I just come to this particular Pete and let me just give a wrong well you, for example, let me just give one and if I just give summit you see that it gives a warning. Miss it. He says you must use this. Form it Enter any single English capital letter only. Okay, let me again give small litter. And if I just click on the submit again you see that and give someone on Let me just give a correct value. For example, if I just give g so d is a single English captain later. And if I just click on the submit button, you notice here that it accepts the value and displays here, that is I p hyphen display equals d. Similarly, if I just give another value C k And if I just give submit You see here that it except this particular value as well And it says I'd be heaven display equal ski, right? No, again, if you just come back to this estimate form this pattern attribute uses a boulder here. So basically there is wondering at the start and there is a boundary at the end and in regular expressions, these boundaries are also called as anchors and we will discuss about anchors when we move to the section on anchors. But at this point. I just wanted to tell you that this pattern actor book you this won't be here at the start and a boundary at the end. So basically, if you just try to use a and give submit to see that it gives a message saying that you must do this, form it, enter in a single English captain later only. So that means you're allowed to enter only one capital letter. For example, if I just give b you see that it accepts this because this particular pattern are to boot will only accept one English captain litter because there is, um, over here and here. But if I just goto this rejects 11 dot com if I just write capital e capital that as range you see here that it matches this a baby and you see that it matches all these capital letters on. Please note that here we have not provided any boundary. So there is no border here and there is no odor here at the end on that is the reason it is able to match everything. But when it comes to this pattern matching in this STM electric book, this uses Boulder here and monitor here. So that is the reason if you just give some random value in capital letters, for example, A. And if you just click on the submit button, you see that it is not able to match this particular value because it is only designed toe match only single letter in this case. Okay, now, if I just change this pattern and if I just see that, did you just make it as high? Okay, on looking, just change it. Hi. And here I'll just say enter high. Okay, let me just see if this and if I just come here, let me just repress it and let me just remove it. And if I just say hi, and if I just click on the submit, you see that it is able toe. Except this height, because there's a boulder here that there is a boundary here. So please don't get confused between this regular expression which is used in this pattern on the regular expression which were using in this projects 11 dot com. So we will understand later on how we can use a boundary at the start and end. When we moved to a section on anchors. But at this point, please keep in your mind that there is a boundary at the start. And at the end, when we used this particular pattern natural in a steaming right. So this is one of the practical example. We have just seen how that steamer forms are using regular expression. So this marks the end off the section on how we can use regular expression in a stable forms using pattern after group. Thanks for connecting. And I'll see you in the next video. Listen. 9. Negation Character: Hello, everyone In this video, Listen, we're going to understand about negation character, so negation characters are represented with a carrot symbol inside the square brackets. So if you see here, this is my opening off scratch record. And this is the goes off my square bracket. And if you use a symbol like this so this is card ask Garrett symbol are You can also say that this is a hat symbol, right? And you can give your characters here. Okay. Either you can give your characters like this or you can also give your characters, like, arrange, for example a tow eat. So this is what is your negative character now what this negation character does So suppose you don't want to match anything between eight to e. So what you can do is you can just give a hyphen e, and you can place a negation character here so it will match everything apart for a tow e. So let's take a few examples. Our food strings, for example, the 1st 1 I'll just say this is thing one, and this is stink. This this I think, and so on. Now, what I want is I don't want to match any numbers. Okay, So what I can do is I'll just place a carrot symbol. So here, I'll just place a garret symbol, and I just give 0-9 So you see that it has selected all the alphabets and it has excluded all the numbers. So here, 123 or hear one, two and three to see that they are excluded. And it only slips All the species or darts are, you know, all from it. But apart from numbers, it's elects everything. Now, in the same example, suppose I don't want to capture anything in alphabets. Our numbers are supposed I have another light, and I just righted in capital later. So this capital. So I have this plane as well, so I don't want to match. All the capital letters are the small letters or the numbers. So what I can do is I can simply right here like a siphon Zet. And then small, a hyphen said, and then zero do So you see that it has not selected anything from letters or numbers. So it has silted this doc or spaces, right? No. I want to match any single character which is not present inside this bracket. So, for example, I just give you ABC. Okay? You see that? It has captured everything apart from this capital, ABC. So from here to here, it has captured everything. And in this lake it has captured all the capital letters apart from a B and C. So you see you. This is dot and this is number. So obviously this has captured this on the Etch I. Yes. So this is in capital and this does not fall between e b or seek. So it has captured others. Similarly, it has captured this as well. Right? But if you notice here, it has not captured C and a again it has excluded this a. So this way you can use negation character. Now take another example. I don't want to select all the walls and I just want to select all the characters apart from bubbles. So what I'll do is I'll just give you a e i o u. So you see that it has selected everything apart from this mothers, right? So doctored and this Listen So thanks for connecting and take care 10. What are Meta Characters: Good morning, good afternoon or good evening to all of you. Let us understand a very important concept called meta characters. Actually, in regular expressions, each character can be described as either a normal character are emit a character. So meta characters are special characters which have a special meaning, and we should be very careful when using them. Fortunately, it is easy to learn meter characters. I have combined the list off major characters here. Now please know that we have discussed about these meta characters in detail as we move further. But in this lesson, I will just give an or view off these meta characters. And as we move further in the course, I will explain all this meta characters but lot off examples, so you will be able to master all these. So here at the top, you can see that we have backs less. So this is the one I'm talking about. So back less is used to precede a meta character or a pre defined character class. So basically it will come before a meta character, which is listed here are it is used in pre defined character classes. As I said, Please do not worry about it. What are those pre defined character classes and how this backs less is used along with them. So as we move further in the schools, you will understand in detail about those pre defined character classes as well. Now, the second made a character you can see here is carrot, so carrot symbol is also card as hat symbol. And we have already seen that. How can it is used in negation character and we will also see how can it will be used in anchors. This will be discussed in detail in a particular lesson called anchors. Now the next made a character we have is dollar. So basically dollar symbol is used formatting a boundary in the end off Elaine, and this is also discussed in details in a listen on anchors. The next meta character is period or dot. So this is used to match any character apart from New Line, and this is ultra discuss in detail, and the next set of characters we have is question mark. Then we have a star or asterisk, then we have plus symbol and curly braces. So all these our park off quantifies and we will discuss about these in details once we move further in quantifying section and if we move further, we have this pipe symbol or it is also called as vertical bar. And this is also covered in detail in order Nation. Okay, so once we moved toe, listen called alternation, we will understand in detail about this pipe metal character. The next one we have is parentis is and this parentis is is extremely important. And you'll massa this parentis Ismet a character. Once you go to the lectures on groups or grouping so have cover all those groups in the day . And if you move further you see we have this square record. So you see, this is the opening off square record and this is the end off scot record. And we have already seen how square records are used in character range and selecting a single character among the characters inside the opening and closing off square records. Then if you move forward, you see that we have this equal toe, right? And then at then we have this exclamation mark So we will cover these equal toe an exclamation mark once removed toe person. So there is a separate section on a substance where people be studying about the person's, for example. Look ahead assertion or look behind assertions, and we will understand about these symbols in that lesson. Now, apart from these meta characters, we also have some pre defined character classes, which also behaves like meta characters, and these are also cover in detail. So, in this lesson, I just gave an overview off major characters here, and we will start mastering them one by one from the next Listen. All right, I'll see you in the next lesson. Take here. 11. Wild Card Meta character - Part 1: Hello and welcome back in this video. Listen, we are going to understand about period meta character superior. Better characters are denoted by a dot, and this is also called as while cut characters. And as Almeida characters have a special meaning similar to that, this dark matter character also has a special meaning. So this is used to match everything except the line rates. And this is very important and ask for my personal experience. I've used this period made a character a lot in my regular expressions. Now let me give a festering here or let me give some group off desks drinks, for example, Java R B a t r. I just give em dealing, and then let me just give I mean for let me give biting, for example, if you full and I give to empty lanes and I just Ruby and let me give a space here and I'll just give Oscar on, just give it up here and I'll give that's Tiemann. Okay, And suppose if I just give a dot here. You see that if I just give dot it has massed everything apart from these new lines. So here we have a new life. And again, this is a length So it has not mess everything. And apart from that, it has matched everything. So here, if you see, doesn't even match this space. Okay, So before we have a space and it has even matched this space as well. Similarly, if I just give a tab here and you see that before HTML have given a tab by just pressing tab in my key book and this has messed that up as well know what exactly is New Lane? No. Suppose we have some more words. For example, if I just give your eight here if I just give cat to see that it has matched this e also, since this is single character So it has met and this is having a three characters C, D and E, and it has matched this as well. Now, suppose I want only met a and I don't want to match see it, cat. Then what I can do is I can just give a bone to here. So if I just give back, last be and here backs last be, then you see that it has messed only a single character right. So here it has messed only a and this is separated by a word boundary so previous toe that it has started after a new light. And again after this a We have a new link, right? So this has messed Onley this A and set off magic the C ity It has messed only this a Now what exactly is new line character? Some new lane character is represented by a backs less and so please know that it is used to represent the end off line. Or you can simply think off this as a line break. So, for example, if I just give you backs less 10 and if I just give capital m So you see that it has given this match right? So this is my new link and I have just given back lesson. And so first it will be new lane and then followed by am. Now, suppose I want to match this from this new late. So what I'll do is I'll just give backs lesson from here and again. I'll give backs lesson and let's give our So I just give capital. Are so you see that this is one newly and again we have this new line here and next it starts with our So it has captured this Now, in the same way we can even give a speech after this newly and capture that as well. For example, if you see here first, let me just delete this. And we know that before this day we have this space, right? So if I just give a backslaps and and I'll just give a backs less that's so basically backs less as his white space and we will discuss about this Backslaps s in detail once we move further and pre defined character classes. So at this point, because nor that if you just give backs less, is it will select white space as well. So first it has selected this new life and then followed by this space similarly for just give a tab Here. You see that it has, like, this new line on the top as well. So if I just remove this back less is you see that it has not Ellicott anything because we have to give a reference point along with this backs less and so if you want to capture this backs. Listen, you have to give backs less, and then you have to give. And so that means before this M there is a newly So this is new Lane and then m, right? No little stick. An example. Suppose I'm texting like this. Okay, so I have our and then we have started r E Then we have Chiari. Then we have percentile and a lot of other words. So here, you see that there is a space as well, and here there is a damp okay. And then we have some four letter words. For example, e r e b r E c O R e and M o R e No. My requirement is that the file should end with R E. And we have any character before our so it does not matter whether it is an alphabet or a number or a hash or a star or anything. So apart for new. Like we can have any character before Ari and this would be three letter character. So I have to write a festering for that. So what I can do is I can just give you dot are so you see that it has selected everything . And here you see that it has even selected this. That is for just give a space and then a tap. It has selected that as well. But along with these, it has also captured airy from this BRD and already from this Emirati as well. Now, if you don't want to capture these, simply put back class B so I'll just give you. But Baldry, So fax last we and you see that it has selected only these on it has not selected these. Okay on if you just give Max, let's be, you know what is that? It is a boundary between never and then onward character. So since star is an onward character, so it has not captured this as well. And you see that it has not captured this percentile, Ari as well. Similarly and person Ari is also not captured. And in the same way space Ari and Tab Ari is also not captured. Now, if you want to capture all these, simply remove this back. Last be here and you see that it has captured everything, right? So basically word boundary is very important. And you have to know that word boundary is the boundary between never and unknown work. So even a space or a tab or a star R percent or percentile will be considered as non word characters. Right? So if you just give back class B here, it will not capture. Even this or this or this, or even the space are damp. So, Doctor and this we do Listen. Thank you and take your 12. Wild Card Meta character - Part 2: Hello, everyone. Let us take another example off. Dark matter, character support. I have a list off Worse with starts with B, that is small letter B on It ends with any character other than a new line. And I put a limitation that these words should be three letter words Now after right at a glad expression for deed words. So can you please go ahead and write a regular expression for the strings? So let me write the strings for like, just give bad. So it starts with B A again. I just your bag. It may give the star Then be hash. It may give be space Are it May give B Is that the M on? Let me simply give the let me give beauty back that way. Right? So please write a regular expression which matters the three character world. And it should start with B, followed by any other character other than new line. All right, I hope all of you are able to do it. So what? I'll do it. I just give b and a dark. So you see that it has captured beauty beauty Be a star, be a hash, be space be? Is that b m? But here since after a there is a new line character. So it has don't captured this on It has captured beauty at B A y Ethel. So on totality it is having nine months is right. So I hope everything is clear in dark matter character. So let us join in next. Interesting. Listen. Thank you. 13. Escaping Meta characters: Hey, everyone, welcome to the section on escaping meta characters. So what I meant by escaping meta character is suppose there were destroying like this. So if you have a district like this on, let us try to patch this backwards less so if I just give backs less you see that it gives me a pattern error. Okay, so how to match this max less So What you have to do is you have to escape. This backs less. That means you have to remove the special meaning off this max less so you have to give a backs less and then a backs less so you see that it is able to match this backless. Similarly, let's try to match this carrot. So if I just give you carrots symbol so you see that it has not met this carried symbol instead of that it is giving a doctored line here on. This means that if you just give carrot, it asserts position at start of the lane. Okay, so there's just denotes the start of the line and this is covered in detail in lessons on anchors. So at this point, please note that if you want to capture a carrot, you have again given back less. So if you just give backs less you see that it has passed this packs less similarly If you just want to match this dollar symbol if I just give dollar, you see that it has massed this end off the line. Okay, So instead of matching this dollar, it is giving a doctor line here. That means it asserts position at the end of the line again. This dollar is covered in detail in lessons on anchors. So if you want to match a dollar, you just have to give backwards less and then dollar right. And this carrot and backwards less are used in anchors. So we will discuss in detail about this. So at this point, please concentrate on what we are discussing right at this moment. Okay? Now, if you see if I just give dot we know that it will capture everything apart from this do like now If I just want to capture this dot What I have to do is just give backwards less. So if you give the backs less to all these meta characters, it loses its special meaning on it. behaves like a normal character. So if you again want to capture this question Mark, if simply, if you just give Fukushima you see that it gives a pattern error. So few characters will give pattern later or a few will not back properly. So in order to escape this again, we have to give backs less on that question Mark. So it matters this question mark. Okay, If you just get star, you see that it gives a pattern era so again to escape this, I'll give backs less and it matches this similarly to match a plus even desk you bless and same goes for this fantasist either It is opening parentis is Are these closing parentis is you have to give a backs less and same goes with this square bracket. So this opening square record, if you just give after this backs less, it loses its special meaning and it will be able to match this. Now if I just remove this, you see that it gives a pattern better, right? So just to fix that you're looking backs less so this is called as escaping meta characters . So I hope the idea is clear about escaping meta characters. So if you want to match all these meta characters, you have to make sure that you give a backs less and then followed by that particular character. Right? So this marks the end off this. Listen on escaping Mehta characters take here and I'll see you. And next listen. 14. Predefined Character Classes List 1 - Part 1: Hello and welcome back in this video. Listen, we're going to understand about pre defined character classes. Last one here, You see that I have six really find character classes. Okay, That is backs last smartly. Backslash capital D backs less small w and backs less capital. The blue and I have backs less us. That is backslaps smallest and backs less capitalists. So if you notice all these are starting with backs less and followed by an alphabet, Either it can be in small kids or it can be a per case. So what exactly are these? So suppose if you just give backslaps and smartly that means you're trying to match Onley numbers. And if you just give backs less capitally, then it is the negation off this particular back less smartly. That means it will match everything apart from numbers. Now here, if you see it is backs less smart. That means it matches on Leeward character. And what characters which matches are capitally to capital this morning do small again and from zero 29 And you can also think off underscore as word characters. So basically, if you see this underscore, this is an underscore here. Okay? And since disclosing off this square bracket is and also with this so it abused Toby a stately. But in fact, this is an underscore. And this is it. Close off that record, right? Similarly, if you just see backlash D, you can also think of this back slash D as 0 to 9. Okay. And you can think of this back less capital d as negation off this. So you can just think of negation off zero to nine. Okay? And if you just see this small w it matches either capital, e capital debt, Smalley toe small get are zero tonight and this underscored. And this backs less capital a blue. It matches all non word characters. So everything apart from this, it'll match similarly backed less small s matters all the white space. So basically, this white spaces, like a single space, are a tab or carries it turn or a new line our farm feed. So we will discuss about these. For example, tabs our Gary Is it done a new life, our farm food and next set off pre defined character classes listed to for at this point, Pisa Tamin, Ludek, If you have back less small s. That means it's a match. All white spaces. On the other hand, if you just give back class capitalists, it should match all non white spaces. So anything apart from space, our dad or can resident or new lane on a farm field, people match all those. So let us take a few examples off this pre defined character classes. And next listen. Thank you and take here. 15. Predefined Character Classes List 1 - Part 2: Hello. In the last video. Listen, we have talked about the pre defined character classes one Andi in that the 1st 2 pretty find character classes. We're backs less small, deep and backs less capitally. Right. So I'll probably stop talking and I'll go straight to the subject and let us discussed a few examples regarding this backs Last e So let us take a fight. So I have this estimate file, okay? And you see that we have some numbers here, for example. 1234 And then again, 1234 Right. And there are some other characters as well. For example, we have alphabets and some functions. Then we have these angular brackets, right? So let us try to match on lee the numbers. So what I'll do is just give Max lest, and you see that it has captured all the numbers. Right now, if you just give back slash d and then access in that case you put of our country after this number, right? So that is the reason it has captured this Because there is a boundary between the word and it, nor word. Right? So this is a long word character. Similarly, you see that it has captured 12 and here it has captured 1234 And it has captured the six entry. Please note that it has not captured the seven or eight. Because after seven, there is no word boldly. Similarly, after it there is no word bolding. No, it just the one thing If I just give backs left me here. Let's see the output. So you see that it has matched this and this one at the six. So here is a word boundary again. We have the sport ball to here and here also, we have a space. So it is also our body. Hi. Now let us take another example. Suppose I want to capture all these heading tags. So we know that in HTML these are the healing tax For example, x one x two. And if you're right, that's three are that's for So these are all the heading, Tex And suppose I want to capture all these heading tags. Then what I can do is I can just give on your bracket that and then back Lefty. Right? So if I just give this you see that has captured everything in these header tags, for example, Actual. That's two at three and four. Right? So this is how we can use this Max Lefty. Now, a little steak, Few examples off backs, less capital. So if you just give backs less capitally you see that it has captured everything apart from numbers. Right? So apart from zero tonight, it has captured everything. Right Now let us take another example. Suppose I want to capture only this. It really didn't number, so we can simply give inverted comma and then back. Satti Axity backs Lefty. Okay. And you see that it has matched this. Now there is another way off capturing a number batter, for example. If you want to limit the lind toe three characters, you can simply give you back slash d and then curly practice number three. So it the same as writing back last e three times. Now we will discuss about this curly brackets in detail when we go to regular pattern. For at this point, please note that even we can just limit the reputation by curly brackets right now. Again, let us take Fillmore example. Now, suppose I have a PHP so This is my PHP code. And here I just want to capture all the numbers which are in format like it is having one digit before the decimal and one did it after their dismal. For what I can do is simply I can just give backslash d and what I'll do is to capture this dog. I'll just give backs less and then not so basically I'm escaping the special meaning off this talk by giving back class, right? And then I'm just giving back less. Be here and you see that it has captured this, right? That is 1.3. So these are the practical examples where we can use back last e r. You can just give here back less d if you want to capture anything apart from numbers, right? So I hope we have discussed a lot off practical examples, So thanks so much for persisting with the cause. You are definitely on the right track. Thank you and take you 16. Predefined Character Classes List 1 - Part 2: We'll come back here for fun and just be to listen. Let us understand about back class small, the blue and backslaps capped Eligible. So you see that again? We have this estimate fight, and I have done some changes. For example, I have just addict, this name equals some deep on the score marble and Sunday underscore. Comotto and I have just added some random numbers just to show this example and placement that this estimable might not work because this is just a random as human file and I have done some changes. Uh, if I just give you backs less dub loop, you see that it has captured everything that is capitally toe capital dead Smalley to small dead on numbers from zero tonight. And it should also capture under school. But here I think there is no underscore. So let me just add in a desk or years anywhere, for example. Let's see here. If I just you in the school on you see that it has captured this as well, right? So it has captured all the pockets. So if you can see you that o c d y b all these are pockets. Letter on HTML is in small lucky. So it has captured these and it has captured 12 And here also it is captive one. So that's capture all the numbers as well. And it has captured this under school. No, Apart from these, it does not captured anything. For example, you see you it has not captured this and again it has not captured this by similarly plus and then inverted comma and then curly braces. It has not captured right now it does just give backless capital w and you see that it has captured everything apart ful capital, e toe that small a two said on number zero tonight and underscore so apart from these, it has captured everything right? Do you see that it has not captured under school and all the alphabets and numbers. Now I have another set off string and let me just give back slash w and you see that it has captured everything including this Underscore, right? Similarly, if I just give capital w you see that it has captured everything apart from capital A Does that small Hato small jag number zero tonight and underscore so apart from that does capture everything right? No, you might not get the same situation in your products and environment Articles juvenile on kit. An exact situation that you have only captured like all the words or all the characters. For example, capitally to capital. That or small a too small or something like that. But most of the time it is a mixture off all the scenarios. So once you will be able to complete this course, you will be in full position to match any text pattern. Okay, so All right, let's close. Decision on matching a single word character are matching in onward character. Thank you. 17. Predefined character classes about white space: Hello, everyone. Let us understand about backs Less s in small litter on Dbacks Last s in Captain later. So we know that backs less small s matters A white space character. Now what exactly is a white space character? So if you just see here if I just you back less as you see that it has masked the stab. So basically, this is a doubt And this is this piece again. This is a space And here you see that man really have given three spaces. So if I just give you for example space again if I just leave a space you see that it keeps on matching guy again. If I just give a space, keep some matching all this Similarly, if I just give it down So in my keyboard, if I just press it out you see that it has messed this If I write something, just enter. Let me again give it out that match this as well again If I just give it that it has matched this again, if I just give it up that matched this as well. It can be a single species. For example, you have this simple space or you can have multiple spaces. Are you can have a cab, right? No, In white space, there are a lot of other special characters as well. For example, we have backed less t That is top character. We have discussed this and we have backed less are for carries it and we have back lesson. So in most of the programming languages, for example, in Java, we used to wear backless and at the end. So if you just get back less and then that means you have to print the next set off output from a new lane so it will give a line break there. Right, So the same b, we can use back lesson. And we have a farm field character also that is back close f and most of the time, people either using back last E or backs less and on those will be covered in next lesson. That is, we have a listen on pre defined character classes list too. So they're just discussed about backs less and and backs last E. Now, if I just take this forward, I just give back less capital s You see that it has massed everything apart from whitespace character. Okay, so you see that it has math, everything apart from white space. So here we have my space, and it does not masters similarly does not match here. And if you see, they're not off white space character here, here and a lot of places. And this backs less capital s and not mess those whitespace characters. Right? So this marks the end off the section on Max less s in small enters and maximise s in capital letters in the next video. Listen, we will understand about back trustee and backs less and so basically back less and and back lusty are part off fights Piece on that comes under back plus as itself. But I just wanted to keep a separate Listen for that. So I have just segregated that Listen from this Listen. All right, So I don't see you. And next video. Listen. Thank you 18. Predefined character classes List 2: welcome people and this. Listen, let us understand about pre defined character classes list too. So basically have combined all the special character classes which are known printable character. So if you see backless and discord as line break or a new line character on back Lefty is called as top card. Apart from these two special characters, we also have back class are and backs less F sub actual s car is called Cat Visitor and Max less f is Cordless phone feed. But we hardly used back less are our backs less f So I have not included that in this list and most of the time in special character classes which are all printable views, backs less M and Max LST So let us understand this with the help off examples Now scientists come here. You see that in the last few when they give back Laissus it masked all the white space character. So basically this white space waas tab or a space or it can be a new line as well. Okay. No, If I just give you Max less and you see that it shows 56 matters right, but it does not able to highlight here. And if you just want to see this new like what you can do is supposed to want to see a new line after this angle record, then what I can do is I can just give the next character after this new ling, which is this angry record. So you see that it has highlighted this now. It has also highlighted this as well because after this new line again, we have this another record similarly safe. I just come down and I want to see the new line character here. Then what I can do is I can just give the next character so I'll just give you capital and you see that it has highlighted this new line. And this is also highlighted because this capital M is given in my search batter and I also give it back less and as well, right? So basically new line character or attack characters are also called as non printable characters because we cannot bring those characters. So let's see how back last Iwerks. So if I just give back trustee, you see that it has highlighted this, but it has also highlighted this and it has also violated this This and this Because these are all taps the comedian enter and I'll press a town in my keyboard again If I press a tapping on a keyboard you see that all of these are getting violated, right? Because these are all the matching ones. If I just give back testy No, You see that in the last week? A listen when we give back less s, it captured these tabs also because back class smallest is white space. Right and backs less and or back lusty are part off fight space. So if you only want to capture a tab, you can just give back last E. If you only want to capture a new line along with some other character, you can just give a new line and then the next character after that new line that it will. I like that as well. But if you just want to capture any white space, then you can just give backs list small s and you see that it has captured everything, right? So does captured the space also and then a tab also. And if you specifically want to show the new line character Then you have to give back less and and followed by a particular character which is ending after this new line character. So basically back less and our backs last e or even back less as that is phone feet are bachelors are that this carries it on. These are all subsets. Or you can say that they're all part off this back less s So you can say that backlash s spirit and back less tea or backslaps and our backs less are our backs last f our child. Right? And these are not printable characters because you cannot drink them. Right? So this marks the end off the section or pre defined character classes list too. Thanks for connecting and take you. 19. What are Anchors: welcome everyone in this. Listen, I'm going to teach some off you. In fact, not some off you. I'm going to teach all off you about ankles. So what exactly are anchors so ankles are used to match before the beginning off? History are beginning off. A late are it is also used to match right after the end of festering. All right, after the end off Elaine. No anchors do not match any characters, but they met a position before or after the characters off each lane. Knowing ankles, we have a character which is denoted by the symbol. So this is the carrot and please move that when this carrot is inside a square back then it is used like in negation character. But if it is not present inside the square record, then it acts like an anchor for Big Ning. Off a string are lane in the same way we have a dollar temple so you can see that this is the dollar symbol and this is used to match right after the last character industry order Lane. So, to understand, this better let us take through examples. So suppose I have this strength, right? So I have the stream. And if you notice here, I have this Gee mode on on this and move on. So basically, G is global more and m is Marty line more on my key lime Mormons dollar and get it must match start and end off each lane for here. They should actually mention that carrot and dollar must start an end off each line. But they have missed to mention here on this causes a confusing here right now. If you just see that the tea and then more enabled And if I just give it, Got it. So you see that we have this doctor light, right? So that means if I just give my dealing more, then protest mast each light. So it has massed just before the starting off each leg. So here, this is the starting off. The light on before that has matched again. Here. There is no data only in newly, so it has mass before that. And again here before this. And your bracket has masked this light as well. Now, suppose I want to match all the numbers now if I just give backs last d. So you notice that it has massed all the numbers and you can see that this is one. And again, this is 12 and three, right? And after that, there are no lights which starts with number. So in this entire strength thes four lanes start with number. So it has massed all those four lanes Peace moved up. This character does not match exactly a character, so it does not occupy any land. Basically, it is used for matching just before the starting off a line our A string. And in this case, it has massed all these four lines. No country did the same case and if I just remove, this might be lying. Would you see that it had messed Onley this one? So basically, when you remove this multilane mood, if you just see here, if you just remove this it is not mandatory for carrot on dollar to match the start and end off each line. So, basically, I have just uncheck this. Andi has only mask the start off this thing. So this is the hotels thing you can see here on this has just met the start of the system. Okay, if I just give you a spacey. You see that there is no match? No, because at the start of the strict, there is no number. Right? So if I just delete this line and you see that again, match this. Now let me switch on this market. And you see that again? That match these four lines. Now, let us understand. What is dollars? So if I just give a dollar symbol here, you see that it has just given a doctor lying here for this daughter diamonds that it does not occupy character if they just positioning the cursor here. So it has come here and here and here. And you see that at end off each, like the positioning of Costa is there. So it has displayed that with help off doctor planes. Right? So you can see that. Tell him you have adopted Lee. And then now suppose I want to list all the dismal which ends with a number. So what I'll do is I'll just give backs last D. So please know that in case of character you have to give before the character on in case off dollar, you have to give the dollar after this character so you see that it has mastered these four lines, right? And if you just give you for example let's give point. Do you see that it has massed on Lee too? It does not matter well. And suppose I have just given your one and I have just given this piece. You see that it has not left this so basically it is giving six matches. So this is the one and we have this match. Then we have this fat again. This has managed the street on Dhere. It has mass one and two. So if you just remove this multi line mood, please see carefully. You see that it is not able to match anything because at the end you don't have any number , right? And if I just give a number here, for example one. You see that it has given one match. So it has matched this one. And if I just delete it And if I just give here one You see that again? It has mass one because this is our deigned and it issuing you. That's one match, right? No, If I just do this backs last E You see that initially this doctor lines on Lee here and here. So basically, if you see here explanation off this it say's dollar asserts position at the end off the strength. So this is the end of the string. So that is where they started. Line is there That means this asserts the petitioner, then off this strength or before the line Dominican. And the reason for me to show you this is because so many people get confused on this Canada and honor. So I just wanted to make it very clear. And if I just show you another example if here support, I want to match dark addict. So if I just give you carrot, you see that everywhere it is coming the doctor lines Because we have given this multilane more right. So if I just revoked this market more then you see that has just given this started line here. Similarly, if I just give dollar here, you see that it has given this started laying here. And if I just enabled this morning, feeling more. You see that this doctor lines are present after the end off each lane, right? So if this Marty line is desirable, then it will be at the end off this drink on. If this is a neighbor, then it will be at the end off each lines. So I hope it is very clear. Do your people Now let me give some example In this case, I suppose I want to match the characters starting with he in the sink. So if I just give Katic and if I just give at E you see that it has captured the 1st 1 and let the tournament for it does capture the stocking off this he in Firstly, And starting off this pian totaling on Let me just remove this smuggling and you see that it has captured only this he from the first like similarly Suppose I want to capture this date So what? I'll do it. I'll just give big and then followed by dollars symbol So you see that at this moment it has captured only this Because this is the end off. This strength on this multi line is not in a bird. So if I just enabled it you see that it has captured all those lines which ends with me. And here it has captured this lane the slain this lane and here this does not end with dates. So it has not captured this again here. Also, it does not end date, so it has not captured this and it has captured this date and this date, right? So basically, the character on dollar characters have special meaning in regular expressions. And if they are not used inside the squared record, then they're called as ankles. So the carrot matches at the beginning off the text, or you can see that the character matters the beginning off a string or the beginning off line. So if you're enabled this murky line, then it will match the beginning off each like. And if you have disable, then it will only match their starting off this string. Similarly, dollar symbol matches after the end off string or after the end off light based on this multilane. Okay, so this multi line is very, very important. So I have given the knowledge on this anchors in detail. So in the next lesson, you will take some other examples off this anchors tell them, take your and by 20. Examples of Anchors: Hello and welcome back in the last week, you listen. We talked about anchors, so let us proceed further and take one example off anchors. So I have this fight there. You see that we have the first line as our program. Then we have a call in on this piece. After that, we have the world successful. On in the next lane, we have coming tote all the camel program calling successful. And in the third blank, we have General Program Colin Unsuccessful and someone. So here we have some stars and then when closing parentis is and then we have, like, this COBOL program successful and then that BHP program unsuccessful. Now what I want is I want to use anchors and I want to match all those lines which starts with Java program successful on its end with successful. So please take this as an exercise and try to do this by your own using anchors. So I hope that all of you are able to do it. So let's see, Ho, I'll write this regular expression pattern. So first I just give Java program and I just give sexists flight and I will see that it has captured this and it has captured this as well. So I just put a carrot here. So if I just put a karaoke symbol here you see that that's captured only this first line Because once purport the character book, it says that please capture from the stock off the stream. Right. And in this case, this is the start of the stink. And also if I just move it to the second name If I just give you something like this and you see that still it is able to capture this because Marty Mode line is a neighborhood. So if I just disable it, you see that it is not going to capture anything, right? So based on your requirement, please enable or disable this Marty like mode for at this moment for this example, I'll just enable this and you see that it has matched this gel a program successful. Now, please know that in some of the files you might have something like this. For example, in this fight, the programmer is trying to say that we have to come in tow all general program successfully. So this is not the actual job program successful pity generated from the court are from the desert, right? So you might get a few scenarios hearing you have toe only match like this. So from the start of the string toe, end of the string, what you can do is just put a character or here you can just put a dollar symbol also. So if you just put a dollar symbol will say that this is the end of this link so you can put this stock and then and also you can play around with this Marty line for this Marty line. Mood is very important in terms off carrot and dollar. So I recommend you to practice a lot. And this anchors and I've tried to give enough information from Mayan on anchors. All right, if you like this, I will see you in the next. Listen. Thank you. And take care. 21. Word Boundary: Hi, my dear students and this Would you listen? We will understand about word boundary. Basically this word boundary we have seen in few examples. So let us discuss this word boundary in detail. So backs less small B is used for part boundary, and this word boundary is used to match the boundary between a bird and a non word character. Now, in most of the programming languages, the word is like small literary, so small it was egg capital literary to captain later said and then hyphen. But some programming language also accept Ah, hyphen Atacama Tetra. So basically, Vote Bumbry matters positions where one side is a good character and the other side is non word character. And the putting off this word, Baldry is not of our poultry on this. Is that represented using back less Capital B? So let us take one example off This what boundary? So here, you see that I have this fine and I've just copying this from some external Sal's. So it says I started working on big mainframes so you can see that there is a spelling stick here and again. It says, kindly maintain the court properly using inundation. And again it says small eatery maintain ability off the court is important. So again, this is not a correct work. Logically and again, the next sentence it is. This is not your means. Stay. And if you move forward, there is a number here that is seven mainly. And then it says the main point is to capture hidden code, which is get get S T and percent now support. My requirement is to capture a full word card main. So you see that in this entire text area we have the word present here. That is, this is the only full word apart from that you see that mean is used here. But this is not the full word. This is the part off this word. Similarly mean is used here as well. But again, this is not a full word. This part off this word, right? So most of the time this back class B is used for capturing the entire votes. Okay, So what I'll do is let us fight to capture this mean So if I just tried to match this mean a sock with writing mean and you see that it has captured this man Also this man also here also again it has captured this mean this mean this mean and this man. But I only want to capture this mean so my requirement is to match only this minute. So this is the full word. And these are all part of words, right? So if I just give backs last be here. You see that? No, it has not captured this mean so this backs Let's be marks a word boundary on. There is no word want to hear. So that is the reason it has not captured this mean from this big mainframes. Similarly, you see that it has captured here because before this there is a space. So space is a non word character. Similarly here you see that there is a space. So it has captured this. But it has not captured this because before this m there is no word boundary. Right? So this Smalley is not a word boundary, right? And if you just move forward here, you see that it has captured this mean as well. And this has ignored this seven mainly. And it has also ignored here mainstream media in that we also see that it has mean But it has not captured this as well. I know what I'll do is again If I just give back slash b you see that it does capture the main only from this late, because we have again given a word boundary. So after this end, you see that there is over don't. But apart from this mean there is no character or there is no word where you see a word boundary after this end. So here also you don't have any backbone tree here. Also, we don't have any word boundary here. Also, we have a continuous character. We don't have a non word character here. So this is how we can use backs less be as where boundary Now let us see if we just give back less Be so you see that these at all word boundary So here before the start of the line it is a word boundary. Then between two words, it is a word bolding. And if you just see here before the end, you see that before this ampersand Also, we have this word boundary Right now it is just try to give backs less capital B and you see that it has captured a free thing which is known word boundary on. If I simply give back let's be I mean, you see that it has captured this because there is a non word boundary here. So it has captured this. It has captured this at this is captured this as well. But since there is a bumper here, so it has not captured this and says not captured this as well. Similarly, if I just give a backs less capital be here. So it has captured on Lee these two. And if you see here at the top, it has captured this mean because this m is a word character and due to this reason, it has captured this as well. And here also it has captured this mean right? So in this way we can use a backslash small B and backs last capital B. No. In most of the practical scenarios which I have seen most of the time, we use backs less small and we use back class capital, be very less number of times. So it is all dependent on your requirement. So based on your requirement, you have to use either back class, small B or back less Capital B. So this marks the end of the section on vote Baldry and not covered Moldy. So thanks for draining. So I'll see you in the next lesson. Tell them, take here. 22. What are Quantifiers: Hey, everyone, welcome to the section. Now a few off you might have taken a gap and joined the schools again. So first of all, I request them to go to the previous lectures Are videos in case they have missed. Listen to what I have said. And then these coming videos will be a lot more easier to follow and will make a lot of cells. All right, so in this we do Listen, we're going to understand very important concept called 20 fires and in regular expressions , there are four types off 25. So I have placed all those quantify IRS in one particular area. So starting from this question mark, you see that this question mark the notes optionality That means the preceding character or a particular group which is present before this 20 fire can only occur zero time or one thing. So that means that proceeding character, our group can occur only one time, or it cannot occur it on. So that is the reason it denotes Optionality. The second quantified or we have is a star, so you can see that this is card star or sometimes it is also called as asterisk on this also denotes nationality, but it did not stack the preceding character or group before. This star can either occur zero or more number of times so either it cannot occur at all our If it occurs, it can occur any number of times right on the 3rd 1 we have is plus so this plus denotes mandatory. That means either the preceding character before this plus must occur at least one times or more. A more flings. So this is the basic difference between Starr and plus So what start is is the appreciating character. Our group can occur either zero or more number of times, but plus the north stack, the preceding character, our group can occur either one time or more number of things, right? So that means it denotes mandatory that at least one character must be present or at least one group must be present. Now the next one we have is called curly bracket. So here you see that it did note number off reputations. Okay, Uh, in fact, this curly breakers can be further divided into three more pointy fires that is curly bracket. And then we have curly bracket minimal and then we just give a comma, and we close this curly bracket, and we also have curly bracket mint. Com. A curly bracket. Max. So what exactly is this curly bracket? And so this curly bracket, and it denotes that appreciating character or group repute exactly an times. So if you just give here for that means previous character are proceeding. Group must repeat exactly four things. And if you just see this, that means it says that proceeding, character or group Most repeat a minimum number off men times and maximum. It can be any number of times right. So here, if you just give curly bracket for comma, and if you just give close off this curly bracket, that means the proceeding character. Our group must repeat minimum off four times on maximum any number of times. The next set of quantifies inside this curly bracket is opening of curly bracket men Comma max. And then you have to close this curly bracket on. This denotes that the preceding character or group can you repeat minimal many times and maximum number off max times. So when I say appreciating character, I mean to say that the character which has come before these quantifies. For example, this curly bracket are the star or this question mark or displace symbol. Right? So some people say that there are six types of quantifies because they consider this a separate. So it is one do 345 and six. But I consider them as four quantifies because this is one this asterisk a second This place one is terrible and this curly bracket is 4 to 1. And these are all subsets off this curly bracket. So basically, what is the need off quantify air? So that point a fire is used after the character or a group and it decides how the character are a group which comes before the quantify air will occur. So 20 fire decides the behavior off the occurrences off the character. Our group before this. So if you are following this, then it is good. If not, it will be clear from the next video. Listen where we will start understanding each quantifies one by one and we will take numerous examples off these quantifies as well. So eventually you will master all these quantifies when we start from the next section. So thanks for joining this. Listen and keep yourself motivated. I'll see you in the next video. Listen 23. Question Mark Quantifier: Hello, people. And welcome back. And to secure we will understand about this question. Mark 20 fire. So let us go directly to the example. Suppose afterwards, for example. Hey, BC and a B and I want to match both of these. So what I can do is I just give your a B, and I just give see question. Look, So basically this question mark will make sure that either the c a p a zero day or wanting So if it appears one thing that it has masked this ABC Similarly, if this appears zero times, then it matches this baby. So this question mark makes you back this character. That means the character which is previous to this question mark, can be awful or monetary. So if it is mandatory, then it must appear only one thing. For example, if you just give ABC see again, you see that it has not mast this seek, and it has only messed this seat right now. Let us take a few other examples for I just believed us and let us at fuel, for example, feller, or you can just see color. Right? So both are seem so basically This is American accent and this is a British accent. Similarly, if I just at behavior and begin also say harbor Okay are, let's say Schumer and again that's a labor. For example, L a b o you what you can also say maybe for you are right. Similarly for this humor you can say that you and poor and for harbour you can just sit a chair. Bur as well. Now suppose we want to capture this color so either it can be colour what can be colour so you can simply give c u l o and let since this issue is awful So what you can do is you can just give you along with the question mark and then you can get our So this will make sure that you have selected this color right? Similarly, if you want to capture this harbor or this harbor, So in the same way you can just give you that year B o. You are right. And after this you we have given a cushion. Mark. So you see that it has captured this, right? So this is a simple example where you can use a question mark in your regular expressions, and this would make sure that the character before this question mark can be made as awful character. So this marks then off the section on question. MMA 25. Thanks for training. So happy learning and take care. 24. Exercise on Question Quantifier: welcome everyone. Let's take an exercise on question. Mark 20 fire. So I have a requirement that I need to match all the fine names which starts with the word Rafael League on It might contain a numeric value, for example, zero tonight and it should be off land one. Please know that these filings are incorrect filings. For example, if this file for four or 568 or if i a b or fine, easy. So it should be easier but the name on Lee file or it would have on finally, like file. And then after that, it should have only one numeric character. So please pause this video and write their regular expression for this particular example, I'd request all of you to please dinar cheat and let's try by yourself. I'm very sure that you are able to do this, so basically, I'll just write my requirement here so I'll just give here analysis and what I'll do it. I just right. Step one is that it starts with fine, right, So this is the common word, and after that it contains a link off either zero or one right, so either it can have on Lee. The name like file or it can have something like file one file to find. 3455 So finally, Right. So I'll just say like it contends. Limped off either zero or one. So for that, I just give back last e and a question mark. Right? And al Qaida, the land the total and is either four or five. Right? So let us write our regular expression based illness, so I just give you fight and backs last D and question mark. Right. So you see that it has captured all these that is filed, filed one file to find three file for and in addition told is it has also captured Final 44 Find six it and fine from this. Find a BS thing on. What? I'll do it. I just give a word. Boulder Here. Okay, so you see that it has masked this fine while one tryingto find three fine for So it has five matches. So this is the actual pattern. Okay, so let me just copy this and I just give the pattern name here. So this is my pattern. So thanks for joining us section. And I'll see you in next video. Listen, 25. Asterisk Quantifier: hello and will come back this feature. Listen, we will understand about this star or asterisks special character. So basically we knew that this star also did not often ality and in deludes that either the character or group which is present before this star can come zero things or any number of things. So basically it cannot come or if it comes, it can come any number of things, right? So let's just take an example off this So if I just come here you see that this is the fight which we have taken in the previous section. And instead of this question mark, if I just give a star, you see that it has captured fine, fine one find to find three find for final 44 and 56 set as well, because this star denotes zero are Oh, so this is the case off zero, that is, it does not have any numeric character. So this backlash t start denotes that this might contain and numerous character zero times or any number of things. So this is the example of zero times and this one this one this one this one, This one and this one. These are all examples off any number of things. So if I just give you fine 86765 or if I just give fine for 432 You see that it has matched this as well. Now let us do one thing. Suppose I want to capture all the files which stars with the name called File, and it can have only alphabets after this file. Okay, So either the name can be only fine or if it contains any other set of characters after this name site, then it must be alphabet. And it might content any number off alphabet characters. So let's do that. So what? I'll do it and set up this back, Lati. What I'll do is I'll just give small a tow small dead, and you see that it has captured this file, maybe five a. C. And suppose if I just had a fight on Capitol A B. You see that it has not passed this as well. And the reason why I'm showing this is because we should be very clear on what the starters . So here it checks for this world called Fine. And if file is there that after that it is expecting any habit. If that is present, then it will match that as well. But here alphabet is present. But this isn't a book. It's right on Dhere. We have given in lower keys and that is the reason it has not captured this. Now let me just remove this back Class B and you see that it has captured this file because there is no word boundary. Right? So if I just give here, for example, let's give dollar. So it denotes the end off the line. Right? So here you see that it has captured on the file five, maybe and find a C right? And if I just remove this, you see that it has captured everything. So it has captured, even find from this fight, Baby Fuller's artist dollar and chicken. Right? So I hope you're getting the idea that this star is very powerful and most of the regular expressions we are going to use either a star or a question mark or a plus. OK, so they are very powerful and they're used in mostly all the regular expressions doctors. The reason I just wanted to make everything clear and let me do one thing instead off giving a two jet. What I'll do is I'll just give backs less and w so it denotes any word character, right? So it'll match either Smalley toe small tech, capitally toe capital debt and underscore sometimes in some programming languages, it also accepts comma or hyphen also. Okay, so it all depends in the programming language in which you are refuting the regular expression. But most of the thing it is a small e so small yet capitally toe capital dead and numbers that 0 to 9 and underscore. Right? So in this case, you see that it has masked everything. And if I just removed us dollar you see that still it gives told matters Because this is just the end of the line. And if I just give the back left a blue, then it matches all the character. So this marks the end of this section on Asterisk are a star quantified. Thank you 26. Plus Quantifier: Hello and welcome back. And this fee to listen we will understand about plus 20 fire. So basically, Plus did not start the preceding character. Our group should come at least one times, or it can come any number of times, So this denotes mandatory. So let us understand this. But the help often example. So if you take this file and suppose I want to match all the fine names which starts would find and it must contain at least one character after five, so it can have one or more character for basically What we can do is you can just give file back, left a blue, and if we just give plus you see that it has captured everything apart from this way, right? So let me just tell you this also because I don't want this doing, you know. And here you see that it has captured everything from this text. Apart from this fight. Right now, if I just give files back last e plus you see that it has captured all that did it after this fight, right? So 51 toe three or 4468 Or you can see that 86765 and so on. Right. Similarly, if I just give you it was it are if I just give Capitally to Capitol dead, you see that it has captured this Fine. Maybe file a c and finally right. And it has not captured the faith because this plus denotes one or more. Right, So this is how we can use this. Plus now, please know, tack before this. Plus, we have seen and most of the examples that we are having a character apart from the character. We can also have a group. So basically, group looks something like this. For example, ABC and then inside this parent is So this is the opening off Parentis is. And this is the clothes off guarantees. And inside this we have a group. Okay, so anyways, we will discuss about groups in detail. But I just wantedto tell you that instead off this character, we can also have a group. Okay, for this point, please. Lord Deck group is whatever we have inside us. Parentis is so this is the opening off parentis is. And this is a close off apprentices. And inside the group, we have characters. So At this point, let me just remove this group and I just give here back, lady, okay? And this backlash d you know that this is a special character, right? So this is how we can use bless, quantify air in our regular expression. So thanks for connecting. And I'll see you. And next will you listen? 27. Quantifier to limit the range - Part 1: welcome everyone in this feed to listen. We will understand about this curly bracket. 20 fire. So we know that. And curly bracket, we have three types off. Other quantifies inside this. So we know that the 1st 1 is like this, for example, opening off curly bracket and then inside that we have a fixed number and then we have to close this curly bracket So it did not stack the preceding character. Our group must exactly come a number of times, right? So let us take some examples for this. So you see here if I just give any text string, for example, text 123 or if i desk you want are let me just give em at D A or some sort off random numbers. Okay? And if I just give one, and if I just give for example treat you see that it has not best anything. So basically what it says is one has to appear three times exactly in order to get a correct match. So if I just give one gunman, you see that it's a match. Similarly, if I just give 1111 you see that it has only messed 111 from this full set of characters, right? So if I just give backs, let's be You see that it has no captured this. Not this on if I just give you back, let's be You'll see that it has captured only this Right now we just dilute this and let us try for characters. For example, If I just give Oh, and if I just see that full. And if I just give here three or let me give five distinct. So you see that it has not passed this. All right. Just give or it it It still is an argument. If I just give or get it, it is not a match. Or that that still it is an argument. If I just give all at that You see that this is match Because what diseases that must appear fight things? No. If I just give here square record, for example this then you see that it has matched this Oh, at at at it. Because what it says is either you or that must appear five things. So here you see that there is old and again it is looking for or edge and it gets a at here and again it looks for a character or or it. And here we have at similarly here we have at and at and we do have at here for it matches this and please know that it will not match at at at at it. Because we know that because this regular expression matters from left to right. So once it has come to this full met, it will start from here. So if you just see here, if I just give or attached at it and again if I just give at at something like when you see that again, this is a match. So this is a match and this is another matter. Similarly, this is a matter. So this is how we can use this type of regular expression that is in college record fixed number of times. And the next week to listen, we will discuss about how we can use just men comma and then close this curly bracket 28. Quantifier to limit the range - Part 2: Hello, everyone. Let us understand the quantify air in which we have to give the meantime. But we don't provide any Max thing. So if you see here in this example, I suppose if I just give one and if I just give three and I just give comma and if I disclose it, you notice that it will only check for all the ones with checkers many 13 number of times and maximum it can be any things. For example, if I just give you 111 women and you see that has captured these so has captured. This has been Now instead of this number. If I just give you an alphabet, for example let's give Oh, so you see that it has not passed anything because minimum number of times or should appear history. So let's remove. Go and try for that and you see that it has captured this attempted here again that captured here, here and here. So if I just give all of it and you see that it has captured this this this and this So basically all has appeared only one time because we're not providing any range for O on for at what we're saying is that should appear at least three times and it can appear any number of things. So this is what it satisfies. Oh, is present on your own time, and that can appear at least three times or more. Right? So this has captured this. And then this has captured this. This and this, right? No, what I can do is I can just try this with some special characters. Also, for example, backs Lester Blue and you see that it has master all this. Okay. And it has not captured this because it does not fulfill the criteria that it would have many women off Three, right? Similarly, it has not captured this as well. So in the next week to listen we will understand about this. Men common Max, type off repetitions. Thank you. And take care. 29. Quantifier to limit the range - Part 2: they come Everyone let us understand about this type of repetition character that is curly bracket. And inside that we have provided the min and Max value and attend. We will cause this curly back. So let's take for examples off this as well. So if I just come here and supple if I just give you backs Lefty, and give the minimum range as to and I'll give the maximum range as six. So you see that it has captured this This fuc it has captured this has captured this on this and it has also captured this. Now the reason for this is see if we just check for the strange minimum. It should have two numbers on the maximum can have six numbers. Okay, now here. If you notice extract. It has masked six number of things. Right? So this is one match now what happens is by default. Regular expressions are greedy in nature. For when I say regular expressions are greedy nature, that means regular expressions price to match at much as possible. Okay. And that is the reason it has captured the six numeric character. And again, if you see here, it has captured six number character, and then again, six numbers it has capture, and again it has captured six numbers on attend. It is left with only three numbers. So it has captured this tree, and here there should not be in and out. I think it is self explanatory because it contains more than two. So it has matched this and you see that this has not mass this month because this does not fulfill this criteria. That means this number should at least be present two times and maximum. It can be present six things. So in exchange this number does something like a summit. And if I just give he do that, you see that it has mask this, that it has mastered this. Okay? And it has matched this this this this Agnes right again, lead us astray. This with packs, left the blue and you see that it has not Mathis one. And apart from this one, it has mass everything. Because this Oh, it's also sort size this criteria that you know what we should have toe and maximum six. Right? So please try with lot off other special characters also our habits, or you can use numbers. So whatever pattern you want to create with this range of values, you can please fight and you can play it on with this regular expressions. So thanks for connecting. And I'll see you in the next. We do listen. 30. Greedy Quantifiers: Hello and welcome back. And this video. Listen, we are going to understand about greedy 20 fires. So we know that in the last few to listen votes forgive Max. Last e commerce six. It has massed eight times. Right, So here, you see that it has it matches. And this is the 1st 1 This is the 2nd 1 and then this is a turban, so T here there is no doubt. But once this comes to this particular string, you see that this has massed from here to here again from here to here and again from here to here, then here, too here and attend. It has left with 111 So it has masked this as well. No, some of you might think that a state off matting from here to here why this regular expression did not Matt 1st 11 and again 11 again 11 again 11 like that because we have given to common six. So why it has only messed the longest possible string. For example, from this character toe, this character white has massed the longest land. Now, the answer to this is because the quantify IRS and regular expressions are greedy in nature . That means it will try to match the longest possible showing. That means it will try to match as long as possible. So here, the state off Matching the 1st 2 It found that the longest one is from here to here. That is exact six character. So it has mass entire six length again. From here to here, it has masked the entire six land because it found the longest possible character. And from here to here it was six length and again from here to here it has six land. And in this case, it was able to find three characters in this particular subset. So it has tried to match this as well. Now, let's understand how this works in bad girls. No, hold a regular expression. Indian behaviors for every position in the deck string. So this is my lecturing. So for every position in this text string, it will try to match the Batam at that particular position. If there is no match, then it will go to the next position from left to right. Okay, Now, first you see here, Max Less D two comma. Six. Now when it comes here first it looks for this backs Lefty. And yes, this is a number. So it matches this now again. It comes here and it tries to match. And we have a new Marie character here. So it is a match again. It is a match again. This is a match. And again, this is a match. And again we have this match. So basically it tries to cover the longest possible value. So here the longest one is six. So cover still here. No, again. It starts from backs, less tea. And here you see that it is a numeric character. So again it matches this again. It matches this and it keeps on matching all the numeric characters until the matter's fault and the longest possible. And it can have a six. So it matches still here in the same way it matters this again. It matters this right now again. When it comes here, this tries to match the longest possible strength. So again you can see that it has come here. It is a match. It has come here. It is a match. It has come here and again. This new Marie character is Matt. So it tries to match this as well. Right? So this is how it tries to behave in a very greedy manner. Okay, Now take another example here in this estimate. Fine. You can see that we have a lot of tax and there are some issues. Also, with some tax, for example. Here there is a star. And actually, this is some Centex er So I have taken a file which has some Centex er in the tax as well. Now suppose in this case I want to match all the tax. So I want to match this tag again. I want to match this tag and I want to match the stack. Right. So all the tax I want to met, which contains some value, for example, In this case, you can see that this is an empty tag, right? So I don't want toe match this But I can match this tag as well because inside this anger record, you can see that there is some characters, right? So even if it is one character inside the angler bracket, I should match that particular tag and I should write a regular expression for that. So if I come here, what I'll do is to write a regular expression for this. What I'll do is first. I'll just give angler racket that is opening off angler record. And you see that it has masked everything here which is starting from this angler record right now. After that, I'm looking for any character, right apart from New Lane. So what? I'll do it. I just give not right. So dark matches any character apart from new light. And inside this Dad, you can have any number of value or any number of flint, so I'll just give plus, and I'll just close this right. But we have a problem here. If you see here, this is fine. This is also fine. This is also fine. But in this case, if you see, this is not fine, because my expectation waas to capture only the tags. So I was looking to capture on Let this, but it has capture the entire string. Okay, so let me just do one thing to make it very clear. I just give a space here and again here also, I'll just give a space on. Still, you see that it has captured this entire string. But my expectation was to capture Onley this photograph tag and again this particular tag right in the same way here also, it has captured this entire string the shit off only capturing this tag and this deck. Similarly, we have the problem here as well. And in this case, also we have this problem. So here you see that what happens is this angler bracket place to Matt with this angler record, then we have dot plus right. That means it tries to match the maximum possible stream. So it comes here, here, here and it keeps on matting so it will match. This will match a space also it will matter be also and then it keeps on matching and it comes here on this is the end of the line, right? So know what it wants is it wants to check for this angler record that is the closing angle racket But it does not find any angle record. So what physically it does is it tries to backpack this anger bracket So again it comes here and checks for Chandler racket and it does not find any closing angler record So again it comes here and checks for closing angler bracket and does not able to find it. So it keeps on backtracking and it keeps on coming here, here, here. And it comes here till now it has not fall any closing angler racket. So it comes here and it checks for this angler record. And yes, it finds an angler record. So it matches this in the same way it matches this and this and this. Right? So this example also saw that this plus is having a greedy nature. And in the last example, you see that this curly bracket is also having a greedy nature. So this quantify it also has greedy nature. So the greedy nature off this 20 fires can be sometimes problematic and there is a fix for this particular problem and the fixes toe make the quantify air lazy, so lazy, quantify IRS are also called as unread e or reluctant quantifies. So what we will do is in the next week to listen. We will take a few more examples off Grady quantify ears, and after that, what we will do is we We tried to fix that particular problem by making the quantify as lady. So this marks the end off the section on greedy, quantify ears. Thanks for connecting. And I'm looking forward for you to join me in the next feudalism. 31. Lazy Quantifiers: Hello and welcome back. And this fee to listen. We will try to make the regular expression, Lisi instead off greedy. So basically lazy quantify IRS are also called as unready, quantify ears or reluctant quantifies. Now, in this case, if I want to make this quantify air as lazy, what have to do is I have to simply place a question mark. So if I just place a question mark after the quantify air that makes the regular expression lazy. So in this case, you can see that now it has massed on lead this one too. And again it has massed 11 again. It has mass 11 and then 11 And here you see that it has matched this 11 again. It has masked this 11 again. This as much as this 11 This 11 and so on right and at. And you see that there is no extravagant for it to match minimum to number of characters. So it was not able to match this right. And here you can also see that this time it is having 17 matches and 98 steps now. Similarly, if you come here And if I want to make this by ticker, regular expression as non creedy are reluctant or lazy. What after do is I have to just place a question mark your just after the quantify air. So if I just place this question mark here, you see that it is giving me the result, which I will expecting. Right. And you see that this time it is having 17 matches and 1 35 steps. Right? So it has successfully managed this this, this and this. And we're also able to get these tax successfully. No, in the seemly for this particular plus quantify air. Let me just at a question mark and you see that I'm able to match the characters with inverted comma. Right? So I'm able to match this particular character and this particular character Now again, if we take another example, you'll see that if I just add a question mark after this start 20 fire. You see that? No, It has captured this title and then this title right again. It has captured this. It's too. And again this has to and then this force less be. And then this particular paragraph tag. So in this way you can make the greedy quantify air as lazy. So thanks for connecting. And I'll see you. And the next we do listen. 32. Alternative of Lazy Quantifier: Hello, people. Thanks for training again and allowing me to share my knowledge across. Okay, let me ask a question. In order to achieve this particular result, is it mandatory to make the quantify air as lazy? Can't achieve this result without making the quantify air as lazy? I think so. Okay, I'll teach you a better way to achieve the same result. And the reason for this is because sometimes when you make a particle quantified Lizzie, then it degrades the performance. And this performance does not affect much if you have a smaller fight. But suppose you have a very big fight than in that particular case. The performance can be a big issue. Okay, so let us do one thing instead off making this particular expression as lazy. What we can do is we can use a negation character and set off making expression as lazy. So let us see how we can make it. So if we take this particular example at this moment, please know that it has 17 matters and 1 35 steps. Okay, Now, what I'll do is instead of making this particular quantify air as lazy values in negation character to achieve the same result. So let me do one thing. I just give character sick by giving opening and close off square record. And I just give a carrot symbol. So this is my Garrett temple, and I just give close off this anger bracket, okay? No, basically, what I'll do is I'll just give a plus symbol. So you see that in this case it has achieved the same result. But in this case, it is having only 74 steps. And we have also achieved one extracting here that you see here it is having eating matches because it has also amassed this particular Dag as well. So suppose you have a PHP tag where you have something like this. For example, this is the opening off angle record and then this is the clothes off angler bracket and this spreads across the line. For example, this isn't three lines, right? And if you want to capture the code like this, it will also capture this court as well. So it all depends on your particular requirement. So if you're asked to capture all those tax with spread across multiple lines as well, then definitely you should always use this negation character because if you don't use negation character and in spite off making the quantum fire as lazy, you will not be able to capture this. So you have to keep on changing your regular expressions based on the requirement. Okay, now take another example. In this case, what I can do is instead of making this a regular expression as lazy, you see that currently it is having two matches and 25 steps, right? So what I'll do is I'll just use Indication character and stayed off making this lazy. So first, let me delete this question mark and and set off this thought. What I'll do is I'll create a character set and I'll just use a carrot symbol and I'll just give double inverted comma. And you see that this time it is two matches and eight steps on the so you see that there is a lot off improvement because it takes on the eight steps while the previous lazy, quantify air waas taking 25 steps. Now, please know that the scattered symbol must be pleased inside this chaotic basic that is opening off this square bracket and goes off this square record. So you have to place this carrot symbol between this character trait. And if you place discourage symbol inside this square record, then this is Carlos negation. But if you place this cattle symbol our times square record, for example, if you keep discovered here that this is not the negation character, right, So this will become an anchor. So in that case, this will be part off anchor. And this means that it asserts the starting position off the line. Right? So let me just delete this and also please know that you should not give something like this. For example, if you just remove this square bracket opening and close off this square record, you see that it gives no match. And the reason is very simple. To make the negation character, you have to give this square record right. So one to enclose this and square bracket, it becomes in negation character. And you have given this inverted comma tell that it should match anything apart from this inverted comma, right, and this is plus so it will basically achieve the same result. But the efficiency is very improved. Naki, take another example in this case. What I'll do is instead off the start. Let me just give this character sick and I'll just give a character. And I'll just give the closing off this angler record. Okay? So if you just give this greater than symbol, you see that you are able to capture this. Now, in this case, it is 17 matters and 68 steps, right? And if you consider the previous example in which you made the quantify as lazy in that case, it was 17 matches and 1 34 steps, right, So you can see that if you're used negation character, it is very useful for improving the efficiency. So if I just make it something like Katic carrot and this greater than symbol, you see that it is having 17 matters and 68 steps. So there is drastic decrease in the number off steps the Rejects tester has taken to achieve this result. All right, I think you got the idea. So thanks for connecting. And I'll see you and the next video. Listen, take care by 33. Greedy Vs Lazy Quantifier: Hello. Let us try to take more examples off greedy and lazy 20 fires and we will try to compare either greedy 20. Fire is better or lazy. Quantify air is better. So we know that greedy quantified tries to match the longest possible strength. On the other hand, lazy 20 fire vice to match the shortest possible string. Now I have two strings. The 1st 1 is stack overflow. And the 2nd 1 we have is a bit silly devil. So if I just give you as not start full, you see that it is able to match till this that is, it has become greedy, distinct. So instead of matching till this Oh, it flies to match till this book. And if I just make it as Lizzie by putting a question mark here, you see that it is able to match till here, right? And if I just go to the next thing that is this a b c d double e. And if I just give you a B c d e star, you see that it is able to match everything right? And if I just make it as lazy if I just give you A B C D e star question mark, you see, that is able to match till every city only because here we have a visit. The east are question mark. That means it will try to match this e minimum number of times and minimum number of times is zero. Right? So it is trying to match still a B C D. But please notice if I just give here, not start, and then question MMA, it will try to match till E. That is a B C D. E. So first it will try to match. Still here that is a B, C D e. And that dark star means it matters everything from zero times to any number of times. So zero being the love ist and it can have any upper value. So if I just put Kashima, it will try to match the lowest value. That means zero. So in this case, it has tried to matter still, a B, C d e. If I just remove this question mark, it will try to match the maximum possible string. So you see that in this case, we're trying to match a B, C D. E. So This is the difference between Lazy and Grady. Quantify. Now the next question which comes to our mind is which is better? Greedy are Lizzie? No. Suppose I have a shrink that is a B and we have to match this particular string. So the important question which comes to our mind as should we write a lazy 20 fire, or should we write a really quantify for this particular purpose? Now, most of the time, we feel that lazy 20 fire is better. But please more that we can automatically say that greedy, quantify air is better or lazy. Quantify is better. So in this case, if you just see if you're just trying to court greedy, going to fire, for example, if I just say a star, be it will match it. Be so directly it will match a B because this a star will look for longest possible match. But if we try to make this as easy quantify, and if we just right a star question lock B, then it will try to match the lowest possible thing. So first time it will try to match a B. But this baby is not equal to a B so it will increase the search on this time to try to match a B. And again this a B is not equipped toe a be talking. This will increase the search on it will goto a B that is able to mask this A b So you can see here that if I just make it as greedy, it is directly able to match a me. But here first try to match a B, then a B, then a B right. So we cannot prove that greedy is almost better or we cannot even say that lady is always better. Okay, so let us understand this with the help off an example. So here we have a sink A b. And if I just try to masters, if I just write a star be you see that it is able to match a baby because this star we've tried to match the maximum possible thing. So it is a B. And if I just put a start, question might be you see that again? It will try to match a B, but in this case, what happens is first. It will try to match a B. So this a B is an article toe he be so again it will increase assert So it will be a B And again this is not equity A baby, right? The knocking it will be a B and this time it will be equal. It be right. And on the other head if I just make it as greedy, for example, it would just remove this question mark. And you see that still it is able to match this it be. But this time, what happens is it will be directly it be because the star this time behaves as a greedy quantify air. Similarly, if I just write a dark star be you see that it is able to match a B. But if I just make it as lazy 20 fire You see that again? This dark star ments zero times or more number of times. So first again, it will be a B. Then again a b. And next time it will try to match a So you see that both will give the same result. But in this case, in this particular example, greedy 20 fire is victor. But there will be some examples where lazy quantifying is better. For example, in our HTML attacks, we saw that if we make the quantify air as greedy, it will try to match everything. That means it will accept the value outside off the tax as well. But then we made it as lazy, quantify air. It will only capture the values which are present inside our tax. Right. So please make sure that you understand the situation off the problem. And based on that particular problem, you have to make your going to fire as either greedy or lady. Right? So I hope it is clear when to use Grady quantify air and when to use a little quantify for Thanks for listening to this particular video. Listen, I'll get you in the next listen, but 34. What are Groups: hello and welcome to the most exciting topic. And this topic is related to groups. So groups are created by including the pattern inside the pair off parenthesis. So you have to place the group by opening this parentis is and then you have to write the pattern inside this, and then you have to close this parentis. Now, groups are used to improve the reusability off the pattern because we can create a group and we can use a simple further by just marking that particular crap. Okay, so you will see that how we can do that. And when groups are used in complex expressions, it improves the readability of the pattern. On most of the time, when I'm stuck in a particular pattern or I'm finding it a little difficult to prepare a pattern, I create a group. And believe me, it makes my job not much easier, because when you see a pattern which is mark under a group, it looks very simple compared do when you use a pattern, our regular expressions without a group. So an important tip which I wanted to share is that venom stuck at any place. What I do is the same regular expressions I prepare using a group and few times if I'm not supposed to use groups. What I do is after I have created that regular expression using groups I just removed that . But your group Okay, now, please. More debt groups also allows us to use all the pointy fires toe a particular group. For example, we can apply this group for a star or question mark R plus R. The reputation, for example, Repetition mint com A. Max. So we will see all these details so times once again and please enjoy this. Listen on groups, because groups are very, very important. And believe me, if you are very good in groups, it is going to make your regular expression much more easier. So thanks for connecting. And I'll see you. And next week you listen. 35. Examples of Groups - Part 1: Welcome back, everybody. Let us take some examples off Groups here have set off drinks. So the first thing it sees blood on in the second line, if you see this article is repeated two times so you can consider this Carol as one unit. And again this little on articulate. Similarly, in third line, you see that Carol is repeated three times, but on in Fort Line are is repeated four times. Now, these type of cases, the best way to match these type of things is to create a group. Now, let us see how we can create a group. So this piano is common, right? So I've just given your Pierre and you see that it has met all these four lines, and I just put the unit here. So Carol is unit rate, So I just put battle and you see that it has massed this. I'll hear the saddle here and the saddle here. And in order to match zero or more times, I'll just give you a star. So you see that this has masked all these four lines. Now, if you see total right, you have the explanation as well. So it is bull matters. The characters pull literally. And the first Captain Group is this opening off. Parentis is Arul and then disclose off parenthesis. Star. Right. So this is our first group. Okay? If you just place your cursor there, you see that it's a is first capturing group. Okay, we will discuss about capturing group as you move further. But at this woman, please note that the groups are marked inside. This parentis is so this is one group. Okay, so this group, if you create you see that you're able to capture all those patterns that this Pierre and again we have this Carol as one unit, right? So if I just give a little star, if you can't hear all those now let us take another example. Suppose I have this particular extreme, Okay. And here you see that we have the first line as the equal operation is referred equal toe in Java. But do we also have unequal operator as well? I suppose I want to capture the word equal or I want to capture the word unequal. Then what? I can do it. I'll do my analysis and I'll see that equal is common. So I'll just write it down. Okay, so I have written equal, and I can see that this u N is optional, right? So first average in the mandatory sub string so equal is my mandatory Patton. So what I'll do is I'll prepare a group, so I'll just say, um and I'll again put a question mark here. Right? So when I put the question back here, this quantified say that this particular group can appear either zero or one thing. Right. So here, you see that it has captured this particular stink as the last this particular string. And here you see that it has given vocalise, right? For example, this equal is highlighted in blue color, and this human is highlighted in green color. So if you come decide, you see that it sees first capturing group, and it has given this particular group right now, suppose if you see a delight here it sees unlucky other ones who are not lucky again. It says, Are you lucky? And I believe in positive attitude and not look and again it has some other details as well . Now, suppose I want to capture the world. A Lucic in luck then what I can do is you see that luck is mandatory, right? So I've captured this. Look now, before that, I can have u N R I cannot have you and as well, right? So I'll just prepare a group, and I just sit You went and it just put a question mark here. So I see that it has captured this. Has captured this on it has captured this as well. Right now, if I want to capture this Y yes, Well, what I'll do is I'll just put away here and I'll put a question mark. But so it has captured this entire work that is lucky. And here this has captured this luck. And here this is again capturing this lucky and hear this unlucky. Now, please know that when you put this quantified here, it does not make this like a group. So if you want to make it like a group, you have to place that particular character or lists of characters inside. This parentis is Okay, So this is a group, but this is not a group. Okay, now take another example in the last line, I have a particular string and it says your vision should be do maximum revision. Actually, this is not a correct tinted. I've just written for the sake off giving a particular example. So suppose I want to capture the reason or reasons. And again, what I'll do is it's very simple. I'll just put rt and the question mark and I'll just give you a soil, right? So it has captured this wisdom and realism. And again, you see that this group is highlighted in green color in this case, right? And you see that it sees first captured in group. Okay, so basically, you can number the groups as well, and we will discuss that as well in the upcoming sections. And I feel that you have God idea off using the group, and what I'll do is we will take some more examples off group in the next section as well. So thanks for draining, and I'll see you next week to listen 36. Examples of Groups - Part 2: Hello, everyone. And welcome back. Let us take a few more examples on groups. So here you see that I have this fight and what I want in this failures, I want to create a regular expression in which it should match the strings which starts the divert logics. Okay. And if there are any characters after this Reddick's, it must be in multiple off three. And that must be numeric. So in this case, if you see, it should match the 1st 1 Because this is the word rejects. And after that, there is no character. So this is also a valid Met. And if there are any characters after this rejects, it should be in multiple off three. Right? So you can see that this is right. This is multiple off tree again. This is more depilatory. So we have one unit off three here and continuously there again. One unit off. Three year, right? That is the length three. Okay, so this is 101 So the length history and again 101 and again the length history. But whatever regular expression, we should create Thatcher, not Matt words like rejects one. Our rejects 11 or rejects 1111 Because here, after the world rejects, you see that this is not the multiple of three again. This length is two, and this is not multiple off tree and again here, the length is only one. So can you please boss this video and write the regular expression using groups? I hope most off you are able to do it. So let me just write the regular expression for this. So I'll just give projects because rejects is the common word, and you see that it has massed everything. Now what I want is either there should be no character after this logics or if the characters are there than attributable to pull off three. Right? So what I'll do is I just prepare a group and I just give a star. So I start the note stack. It should be either zero or more times. Right now inside this parentis is what I'll do it. I just give backs last de for numbers and it sort exactly come three times or multiple of three times, right? So I'll just give three here and let me just close the curly bracket and you see that it has mastered this this. But it is also mask this. This and this. So basically, what I have to do is have to give the end of the line. Great. So let me just give the anchor here, so I'll just give a dollar, which is the end ogling. So you see that it has matched the 1st 1 that is displayed chicks again. It has messed that x 101 So after this projects. So one driven is exactly Delenn three. And here after rejects, it is 101101 So here the length is six and that is the multiple off tree. Right? So you see that this time we have used the group with a reputation quantify air, and it does take another example. So here, you see that How just next year. So I have just returned that Welcome to the best coast off regular expressions. This court is not going to bore you. Right? So here they re word cardboard again in this line have written Are you getting bored? And again this work that is bort comes here and again in the last light average. Um, I have made sure that the league just are not worried. And I hope so. So here. You see that again. This is Bula. Here it is. Bur 80 And here it is Bor. So basically they're bored, then board and pulling. Thank you. Now suppose I want a regular expression which would match all these three walls. So if you just start without group, you can simply right as Bor. And then you can just create a character set so you can just say a to Zed, right? And you can simply give plus right? So you see that it has met all these three And here. Actually this is the actual examples. So here, this has massed. This is actual match and this is also a perfect match. Now, if you see here it is having six matches and 32 steps, right? Please know this carefully. Six matches and 32 steps. No, if I just use a group. So basically what I'll do is I'll just make this as a group. So good to see you. What I've done is I've just made this as a group. And this time you see that it is having sex matters and 62 steps. So you see that this time when you prepared a group, the number of steps has increased drastically. So what I'm trying to say is it does not mandate tree to create the group because performance is also important. So if you are able to achieve the result without a group and with less number of steps, then please go ahead and use that particular regular expressions. And if you are not able to create that regular expression without the group, then you go ahead and create a group. Now, sometimes what I used to do is if I get confused, then first I create a group, and what happens is, once I have created a group, even the complex regular expressions will look very easy because what you're doing is when you create a group, basically you're creating a unit, so you can easily see that what you are doing as a unit. So once I have created the group, sometimes I just delete that group. So at the end, I'll just delete it for that. It improves the performance, and please know that we can also use this group further. Okay, so if you just give a group here? You see that? It says First captain group. Right? And actually, what happens is by default. FedEx tester, a science, a number of this group. And we can also use this number as well. Okay, so we will see that how we can do that and fuel upcoming sections. So thanks for connecting. And I'll see you. And next we do listen. 37. Numbering and Back Referencing: Hello and welcome back. And this video. Listen, we will understand about back referencing in groups. So if you take the previous example and let me just add another string here. So what I've done is I've just added one extra idle here and simple And here if you see in this explanation here, you see that this is the first capturing group and the seas Parentis is inside that it is our right. So this is the first captive in group. Now suppose in this particular string have something like, say, a B c and again I have this added. So you see that in this case it does not captured this entire string. Now, if I want to capture a thing like this also, what we can do, we can use back referencing in that case. So basically tojust match ABC after this. Carol What? I'll do it. I'll just give ABC right and again we have this parent right so tojust match this Carol. What I can do is I can just give backs less one and you see that now this is a match. So this backs last one basically refers to this particular group on if I just give back class one, that means I refer to the first group. So if you see here, it gives the explanation of this as well. That is backs. Last one matches the same text at most recently masked by the first capturing group. So whatever this first captain group will match this backs less one will also match the same text. OK, but in this case, you see that it has only matched this ABC. So what I'll do is I'll again make this ABC as optional. So you can just make this as a group and I just give a question Mark your right. So we know that we give Kashima. That means it is either zero or one thing. So you see that now? This has mastered this because this is one time here, it considers that ABC does not occur anything. So this is a case off zero match, and that is the reason it has matched this. But interesting on using the same with this has met this party clashing as well. But you know that it has not captured this, but right. So what? I'll do it again. Put a question mark here. So you see that if I make this also as often now it does best everything, and we can also put this inside a group also. So if I just put it like this, you see that this is also a group. So this is the first group. This is our second group, and this is a target group. So basically groups are formed from left to right on in the explanation. You can see here that the first Captain group is the slope, right? And if I just strolled on you see that the second capturing group is this part girl pattern right at this is 1/3 captain group. So I hope that I guess clear. So again repeated. So what I have done is basically I just wanted to match a shame something like this. So what I've done is I've just added ABC and you see that it has not matched this. So what I've done is I've just referred to this particular group again. So I've just given back left one because this is the first group, okay? Because the groups are formed from left to right. This is the first group and you see that this is a full match, but I can see that it has not mastered this. So let me just make my ABC as optional. So I looking make This embassy is off tonight, right? So it has not all these three. And here I see that it has not matched this on. It does not matter this as well. So that means what have to do is I have toe make this back referencing also obstinately. Okay, so let me just put a question mark here, and you see that it has masked everything. Now, this is my first group. This is my second group. And if you want to make this also as third group, you can just put parenthesis here and you can just go with it. Okay, So this is how we can use back referencing. So instead of writing this pattern again here, you have just referred to the previous pattern, and we have just reused that. Now take another example. Suppose I have this screen and you see that this looks like something like a date. Okay. And suppose I have written a pattern for this particular strength. So this is a number two digit number again. We have a hyphen. So we have given hyphen here and then I get to the September. So we have the store digit number and then a four digit number. Right now let us make group. So basically what? I'll do it. I'll make this adequate. For example, Let me this as a group. Okay, on. Let me again make this also as a group. So here, you see that the first Captain Group is this one on the second Captain Group. Is this back Lefty off four right now. Simple. Let me first copy this. And I suppose I have added another stream like do one. Now if we want to match both these things so normally, if we don't know back the fronting What we are going to do is we will just put the hyphen and then we will say backs Lefty on. I'll just say two times. And this is a match, right? Are we can also do like this like Well, just make this like a group. And I don't like this right this time. It has captured only this, so I'll just make this as optional. So it is. It a zero times off anything. Now it's syrup doing this. What I can do is I have already captured this back last deal to in my FastCo. So this is my first group. This is my second book. This is my tired group, and this is my fourth group. Right? So instead, off making this what I can do is I just remove this and I just put the hyphen here and I'll just give backs last one. So you see that if I just give back less one, it has captured this pattern, right? So whatever this particular pattern will be doing the same functionality. This Max less one will also do because backs last one is this group one Right now, you can also do look like this like this hyphen you can remove from here. And you can just put it here. OK, But in this case, you see that it has not matching this. So what you can do is here also, you can just put a question mark and this has mastered both off this as well. So basically, I just want to show you that there is no fixed regular expression. OK? So based on your requirement. You have to keep changing your regular expression as well. So I hope that idea is clear on if you see here what I can do it instead off keeping this iPhone and then question Mark, rotate what? I'll do it. I'll just keep it inside, so I'll just keep it here and I'll just delete it from here. Right. So both are saying now what I'll do is I'll just copy this on, Let me put another string and I'll just add town. Fine Here. Now, in this case, I want to capture this string as well. So we have to change your regular expression again. Distinct. Now we know that this total than five is having a pattern off back last E off four. Right? So the first step is either you can directly right here like I can write hyphen and then back LSD off four. And I'll just make this as often. So you see that it has captured this 1st 1 this last one. And what I'll do is I just make this as a group so that it captures all the things right, so this method is fine, but instead a freighting. This backs last dear for what I can do is I can simply refer backs less too. So if I just refer back less to that means this is my second group, right? So this is my first group and this is my second group. So this second group has captured that text This not this 2005. So if I just left for this backlash tow truck captured the same text that is two times five . Now, if I just got bit this again And this time, let me just make it as 2008. So you see that if you use this particular pattern, it is not going to capture this. And the only reason is because this particular group initially captured 2005. So next time, this particular pattern is also suffering, Toto time five. But in this case, since you made it as 2008. So this particular group is not able to point to turn five. So if I just make trickle down five you see that this will capture this dude, doesn't I? Now the fix to this problem is suppose you want to capture something like this. Then instead off using this back referencing you can just use back slash d on you can just parade the number. So in this case, this is Ford plant, right? So you have just given back last D before. So there are two steps. If there is any change, so either you can use back referencing. So if you're using back referencing, please make sure that you have the same value. For example, here it is having 2005. And here, if you again have total and five then there is no problem. But if you have the same pattern. But the value is different because in this case it is 2000 and eight. So in that keys it won't work because this particular group is a friend. Toe five not doesn't eat. So I hope everything is clear and have provided enough examples. So please practice a lot and this groups because this is very interesting. So thanks for connecting. And I will see you in the next video. Listen, take care. Bye. 38. Non Capturing Groups: Hello and welcome back. Let us understand about non capturing groups. So in the last example, if you see here we have this first group. This is the second group at the system Hard group. Now, if you see here once we have made this group, What happens is the Red X Indians acquires more resources on memory once you create a group . So in order to optimize the resource is what we can do is we can make this ABC as not capturing group now. Few CEO, this is first caption Group on it is displayed here at first Captain Group. Similarly, this ABC with parentis is and cushion. But this is second capturing group on. This is the card Captain Group? No, since this first capturing group I am using here. Right? So I require this. But if you see, I don't require this as Second Captain Group because if we are going to use it further, then it is poking to make it as capturing group. But in this case, I don't require this as capturing group. So what I can do is I can just give a question mark and according so once you give a question mark on the colon that tells the rejects engine that please make this as non capturing group. So you see that still your ableto get the result but to save resources have made this as non capturing group. And here you see that the first group is this R l. And then it says that this is a non capturing group. So you are able to see this, that if I just give question Mark Colin and then ABC and then closing this parentis is says that this is not capturing group. So basically you can make any group as non captain group by just putting a question mark followed by equal in. Now you see that this is my second capturing group. So this time this backs last one has become my second capturing group. Earlier, it was my turn Captain group. Right now take another example Now, in this example, if you see, I have made this as first capturing group and this is my second capturing group and this is my third capturing group. And this is the fourth Captain Group right now again, I don't require this Toby capturing group because it is a waste off memory. So I just give question Mark and Colin and I can do the same with this Captain group as well to make it known Captain Group. So now this becomes a non capturing group on this also becomes a non captain group. So you see that the first Captain Group is this that if I just really don't you see that second capturing group is dear for So this is my second capturing group. And after that, Delia non capturing groups. So this one is known Captain Group And here also, you see that this is again a non capturing group. So in order to optimize your regular expressions, it is better to make a group as non capturing group. And it optimizes your regular expressions on increases the performance off the regular expression as well. So please make sure that you practice a lot in this non captain group as well on. I'll see you in next feudalism times and take care 39. Alternation in Groups: Hi there. Thanks for draining this. We do. Listen, I see that you are doing great now in this particular listen, let us understand about alternation. Know what exactly is automation? You can consider alternation as logical or okay. Now here. If you see in this example suppose I want to either match Java art, I want to match global. Then what I can do is we can simply create a group. And inside the group, we can simply rate java. What for, Logical? Or you can just give a pipe symbol and we can desk you. So you see, here it has masked Java and Kabul. And despite symbol is used for ordination. Okay, Now let us take another example. So here, you see that we have some methods. For example, The name off this method is Get name. Here we have this get mattered. Here we have set and then set name. Right. And suppose I want to capture la mitad names. So I see that here. Either it starts with the get or it's start with sit, right for what? I'll do it. I just give, get and then a pipe symbol and I'll just give set right. So that means either it starts with get or it starts with tech. Now, after this get are set, either it will end with this opening off Prentice's or it will contain any other word character, right? So what I'll do is just give backs less the blue and I'll just give stuff and you see that it has captured the matter name. So here, no matter name is get name. And here the method name is get and similarly here, the set and set name metal names are also captured. So here we see that it has four matches and 1 90 steps. Now we can't even write this pattern in a different way also. So what I mean is that my first delete this and what don't do is first I just right get and I can see that after that we have any word character. So I just give backs last w right. And I just give star and at this point, you can see that it gives pattern later because I'm getting too close. This parentis is now. This is my pattern for get on. I'll just give a bite symbol and I'll just give certain and again backs last w And what I'll do is just give us doctor and I just close this. So you see that it has captured get name get set on this signem. So it is up to you. So whichever regular expressions you're comfortable with, you can write that. But one important point to note here is Do not put a space. So here, if we just put a space, you can see that there's not ever to match this, right, because it is expecting a space as well on that is wrong. Okay, so if you just remove the space, you see that it is Capture the name off this matter name correctly. Now let us take another example. So here I have a file which says that finally is filed one find 25354 and five and support . I want toe use alternation in this case and I want to capture file one. Find three or five. So what I can do is I can just right here fight, and here in parentis is I can just straight one. Then I'll just give pipe symbol. That means logical are and I just give three. And again, I just give a lot of our and just give five. And it may disclose this, and you see that it has captured 51 while tree and fined five. So these are some examples of how we can use ordination. So please keep on practicing. The more you practice, the better you get for tanks again. And I will see you and next week to listen. 40. Nesting of Groups or Alternation: hello and will come back. Let us understand about nesting in groups are nesting in alternation. So we had one example here and this is the pattern. So this particular example No support. We had this fight, For example, We have I went to after this ABC and let me just copy this. And this time I have something like do faith. And we know that after this ABC we will be having either 12 or 25 Now, In that case, what we can do is it is best to do nested ordination. For example, if I just see, this is my group, right? So National coordination mints creating an automation inside an organization that is within an organization. So what I'll do is here I just create another ordination here. So basically, what I'll do is I'll just give 12 or I just give 25 right? And you see that this is Carless nesting in ordination. So this is my main cook that is from ABC that is from here to here. So this is my main group and inside this group have created another that is from here to here. So this is called nesting in ordination. Now let us take another example. So you see here that I have another fight which has the content like java feet, Coble, be five and saw. So basically, I have different versions off Java that is job over than eight and restart for was in here and again Cobell v five. Again, this re stands for a different type of worsens, right? So what I can do is so basically I want to create a regular expression which will match these shrinks. So in this kid, what I can do is I can create nesting off ordination. So here, what I can do is I can just write java and in tired this I can just fight. We fight or I can have V seven v six. Or I can have V eight, right? And a king. I'll put pipe symbol so by symbol is logical are and want to let me just copy this. So let me just copy this instead of typing again and again. So I just do like this. And instead of this shower, I just make it is this time global and again for this shower, I just make it us as Deimel right, And it just close this so at And I don't require any pipe symbol. So I remove this. And here you see that we have a space after Java Are Africa bubble or a Fletch damage? Right. So what happened to it? We will just give back less as okay. So if you're sure that it is only one space land directly, you can just give like a space are if you don't know whether exactly it is a space or a white space than what you can do it, you can just give back less s right. So again, here, Just give MacInnis is and I'm just giving where class as here has been. And you see that this has correctly masked my pattern. If you notice here, this is the main group, right? So from here to here, this is my main group and inside this main group have again created a group. So this is called nesting off group, and you can even think of this as nesting off ordination. So this is an ordination here, right? And this is a perfect example off nesting in automation. Now there can be another way off writing the same regular expression. For example, if I just corporate this, let me just keep it here. And what I can do is this time first, I'll capture all these words. For example, Gava or Kabul or Esteem. So basically, just copy here. Like dour. All right, a steam ill are right. And I'll just give back slash s for White Space. And I'll create another group that is V eight. And then I just give r and B five and I just give every six. Right, So you see that this has also achieved my result. But if you notice here that this is not nesting off ordination in this case, we have created two groups. Okay, so let me just copy this. And if you notice here it is having five metals and plea for different steps. Okay. And if I use this, you see that if I just place it here, you see that it is having five matters and 4 76 steps. Right? So it is up to you. So if you're comfortable with the first regular expression, and you can go ahead and write this regular expression and if you are comfortable with the 2nd 1 you can please go ahead and create the 2nd 1 But please note that the 1st 1 is called nesting, and the 2nd 1 is not actually nesting in this process. In the second example were exactly created two groups, and this one is one ordination on this one is another ordination, right? So this marks the end off the section on nesting off ordination. 41. Positive Lookahead Assertion-Part 1: Hello, my dear students, let us understand an important concept car. Look ahead. A system. Sometimes what happens is you want to match a particular spring and you want to match that . But cursing based on the value off string which comes after it, and that this guard has looked ahead. Assassin. And we know that assistant means that a statement that you strongly believe to be true, right? So basically, look, I had a system is divided into two parts. The 1st 1 is one step look. Assassin on the second part is negative. Look, assistant. So what exactly is Boston Look assistant and what exactly is negative? Look ahead, positive look had a system is denoted by a question mark and then on equal to operator, and it sees that match. The character or the characters are a particular group. If a particular element or a certain element that comes after it is also present. For example, what I'm trying to say, supposed to have two elements. So this is X, and then this is why so X can be element or character or group of characters. Similarly, white can be an element or a group of elements So sometimes we want to match only X based on the value off way. So what exactly we trying to say is match X on Lee and only if why is present. So in that case, it is called as positive looked. Assassin, please don't that here we're only matching X were only matching X provided the my exists. On the other hand, negative Look, I had assertion is denoted by a question mark on then exclamation mark. So what? Basically it's easier we have to match the character or characters are group off characters if a particular element our characters does not come after it. So basically, if you see here we have X and y And what this negative look ahead assassin does is it will match this X Onley If this way is not present again Please Lord, that it will matter Only X will not match way Okay And this X can be a character our group of characters Similarly why can be a character or a group of character? Okay, so we have to match this ax only and only if this way is not present. Then in that case, it discard as negative Look ahead assassin. So it will be clear with help off your examples. So let us take a few examples Now, in this example if you see here we have two strings on you can see. Here it is final abc dot txt Fighting exercise that one doctor txt and sought So this is text fight the 1st 2 and the 3rd 1 is speedy a fight and the 4th 1 is jpg file No support Our exercises we have to match the text are showing it comes before txt. Okay, so can you please tell this is an example Off which Look, I had a source Yes, You guessed that plane This is an example off positive. Look at assessment because we want to match this particular value. That is either this this Onley If Doc txt comes after this on bees or that we're not matching this entire sting, we're matching only this string which comes before the extra. Okay, so in this case, we have to use a question mark along with equal to symbol. Right? So let us see how regular expression will look like. So for this fine ABC, what I'll do is just like backs last W Because this can be anywhere. That is a to get our number from zero tonight. Or it can also have underscore. So I have just given back slash the blue and I just give your plus. That means at least one time they should come. Right. So have just given Plus And what? I'll do it. I just create a group. And inside that I just keep assaults. Um, so I'll just give question Mark equals and this means that this isn't positive. Look, assassin, you can see that when we bring our closer here. It denotes positive look. And now we have to match only these words that is, finally we see or five x y z one. No, What I do is for dot txt and just give dot txt. But you see that when I just give dot that means dark will match any character. But I want to match this dark. So I have to just give backs less to escape this. And you see that now it gives me two matches, and it has only masked this fight, ABC and this fight X rays that one right now let us take another example So if I come here , you see that I have a few shrinks. For example, af unc on this is parentis is so this denotes function and you can see that I have three functions and the last one we have is a few NC and then we have this square record, right? So suppose my requirement is that I should match day string which comes before this parentis. So before this opening and closing off this parentis is whatever word is there have toe create a regular expression to match that particular bird. Right? So let us create regular expression and I'll just give fact, lest the blue, because this is a word character and at least it should come once. So I'll just give plus and what I'll do is just give positive. Look at assassin's at this question. Mark equals and what I'll do is I just give opening and closing off. Parentless is right Now. If you're not here, this becomes a capturing group. But we want to escape this because this becomes a special meaning. So what I'll do is just give backs less and again here, just give Max less, and you see that it has captured this affluence E that gets full and that sex one, Right? So please go ahead and try in your system as well. And let us take a few more examples. So here, you see that we have five words. That is databases, little banks, databank databases and data basing. Now, suppose I want to capture on Lee does substance, after which the string bass comes. So here. I don't want to capture the entire world. I want to capture only do substance after which the word base comes. Okay, so let us right regular expression for that. And in this case, also, we're going to use positive look at a system. So what I'm going to do is I see here that whatever words I have all are having your kiss for bits, right? So I can just give 8 to 10 and at least it should have one character, so I'll just give Plus right now, please note that if you have some other characters, you will not be able to give e I found that you have to give like, dark or you might very quiet give backs last night. So it all depends in your requirement. But for this particular example What? I am going to drink it that before this base all are having your kids alphabets. So in that scenario, it looks fine. So I have just given this character ridge, and I've just given Plus that they note that at least one time this particle character should be present. Now, what I do is I just check for the word beast, right? So I just give question mark and then equal toe, and that makes this as positive. Look ahead, assistant. And I just check for the word beast, so I'll just give bees and let me just close this. So you see that it has captured the state Abi's. And it has also captured this detail Mrs as well. All right. No little stick. Another example. So here, you see that I have a lot off strength, for example, PHP. And then after that, we have a space and then court again. Here. You see that we have fightin space school in the third line. You see, here we have this bull, and after that, we have a tab. Okay, So please note that this is not a space this is a tab and then we have this court and you can see that in fourth line. We have COBOL code. Then we have Java class and then esteem and fight. Now what we have to do is we have to match the string which comes before the world could. So if you see, this is the correct match again, this is the correct Met. And in this case, this is the correct Met. And similarly here this is the correct Matt. So I should get four matters for this particular match and the second exercise it says that match the string which comes before the world. And you see that there is a space here and then court. So basically, we have to match only this PHP fight on pull and Kubel for the second case. But for the first case, we have to match belong with space. Or you can see that here also it is space or a tab. So can you please pause this video and try to write a regular expression using positive look assistant? So I know that most off you are able to do it. But let me show you how I do it. So I just want to match the characters or strings before this court, right for the 1st 1 You see that I want to capture everything before this court. So what? I lose just right. It does that, considering that everything is having a fabric and small case and I'll just give plus and what I'll do it for white space. I'll just give back less us on the reason for me for giving this white spaces. I want to capture this as well as this. And here there is a tab, right? So if I just give back classes, it will solve my problem. Right now, what I'll do is I'll just create a group here, and I'll make this as look ahead assistant on. What I'll do is I'll just give question. Mark and I just check for the word Ford, right? And you see that this is sort of my exercise one. Right? So it has given pH piece piece by Tom Space pulled dab Corvallis Peace. Now, for the second question, if you see we have to match on the words before species good. So this is very simple. What I'll do is I'll just remove this backs left us and I'll just place it before this Good . So if I just give back Plus, as here, you see that it has captured on the PSB bite on board and global. So we have seen enough examples off this positive look at a system. But as I have requested many times, please keep on practicing and I'll see you in the next video. Listen, take your bike. 42. Positive Lookahead Assertion-Part 2: in this particular example for See, we have job record html cord Java class a steaming class ball court and Bolkus No support. My requirement is that I have to match their text, are ashamed that has a substance which is space and then followed by a code. So you have to match all those words. For example, Java, because it ends with space and then could similarly we have to capture this Stammel on it follows by a space and a court. But the third thing, for example, if you see you, it is having Java and it is followed by class, that space and then class. So we don't have to capture this Gellar in this case. Okay, so let us try to write a regular expression for this. We have either Java order. We have that steam in our we have fun, right? And if you notice here, it has selected all the strings. So what after do is we have to simply say that only capture those words which have space Ellen crd after that. So I'll just give question Mike and equal to and I just give backs less as so backs less s it did not start. It is a white space. So in all these examples you can see that it is having a space. But even if you have a tab, for example, if I just give you html and then at that and if I just give court, it will capture this s Phil. So if you only want to capture a space, you can just give a space here simply like this. And then you can just give core and you see that it has captured this this and this. But if you want to capture this as well, we have to just give backs less s and I'll just delete that space. Okay, so in this example, you see that it has captured this 1st 1 second, 1/3 1 and this 4th 1 Okay, Now let us take another example. So here I have few meters and have few law metals, for example. I have get full and you see that it is opening and closing with parentis is that means it is a method in most of the programming languages. For example, in Java, it is a method. And if you see the set for so this is also embittered. So basically what I want is I want to match all those words for example get full and set for So I want to match all those words after which we have opening and closing off parentis is so. Can you please pause this video and try this regular expression by yourself? Using positive? Look at a certain All right, most off you are able to do this for later. See how we will do it. So what? I'll do it. I just write kick for our I just like sick phone and this is an ordination have created and you know, just give question Mark equals do and I'll just say left parentis is so I just give back less and then opening off this parenthesis. Now the reason why I have given this backlash and this open off parenthesis is because I don't want that this Prentice's should have a special meaning. Okay, so just toe remove that special meaning. I've just committed backs less right. Similarly, I should give back less and then closing off. This parentis is so This is this parentis Is is what I have listed here. Right and again I have given backs less. And now what I'll do is I'll just give closing. Parentis is to close this positive look ahead at certain. So you see that it has captured only the sec foot and get foot right now let us take another example Here, have a fight on it says the e m p d et Dr Txt Contents employed detail. So this is employed detail. Fine. So employed detail dot Txt And again this is AM pdt dot pdf That is implied. It can not believe Similarly, we have Stu dy DT, doctor texting. And it can be something like student details, not txt and so on. So basically my requirement is that I want to match Onley those ports. For example, this PM PDT afterwards we have doc Txt. So can you please pause this? We do, and right at a glad expression. Using positive Look, I had a system. All right, I know that you're able to do it, so let me to show you in case anyone off you are not able to do it. So what? I'll do it. I just give you e m p day 80. Okay, so it sort of start with MPD didn't write. And after that, I should have Doc txt, right? So I just give Kashima equals and I'll just give back last dot Txt. Right. And again, I've just given back last year because I want to capture the literal meaning off this dock . Okay, so you see that it has captured this E m PDT. And again it has captured this PM PDT. Now, just to capture this particulary impunity, you can just use ankles. For example, if you just give a carrot symbol here, you see that now it has captured only this. That is starting point. Right? So at this point, let me just remove it. And you see that it has captured this at this, right? So once again, tanks for draining decision. I'll see you in the next video. Listen. 43. Positive Lookbehind assertion: in this video. Listen, we will understand about look behind a Cecil. So here, if you see and look behind Espersen, we have two dates. The 1st 1 is positive. Look behind a certain And the 2nd 1 behalf is negative. Look behind a substance Now what exactly is positive? Look behind us! Awesome! So positive Look behind person is denoted by a question mark and less than symbol and then equal to operate. Okay, And this means that we have to match the character. Our characters are group if a particular element our characters comes before it. For example If you see here suppose I have one element here and I have another element here on day we want to match only this particular element. That is why Onley and only if X is present. Okay, then this is called as positive. Look behind SSL. On the other hand, negative look behind SSN is denoted by a question mark than less than symbol and exclamation mark. And what it says is please match character. Our characters are group If a particular element, our characters does not come before it. For example, if you see here we have one Everyone collects. And we have another element called by. So in this case, match only, right? If and only if x is not present. Okay. Here, Matt. Why if and only if x is presented on Dhere. Mad only. Why if and only if x is not present. Right. So let us take for examples off this positive look being a system on negative took behind a Cecil. Now here, if you see, I have this particular piece off information. For example, Java cold Estimate scored again. A similar tab code. And so right now I want to capture those words before which we have our So here you can see that we have Java and again here we have our right. So basically my requirement is to capture only doth words which are having the value off court on Before that, That should be word called Java. And of course, there is a space here, so that also is included. Okay, so let me just go ahead and write their antics for this. So basically, I want Java before the world court, right? So I'll just use a question mark less than symbol and equal toe, and I'll just say Java, right? Didn't just close this. So this is my positive look behind a system. Right? And you can see that it has given this mark here and here. Now, after that, I want the world court record. Right? So just give c o d on before that. I'll just give space or white space. Right? So you see that it has captured this word called Cool. Okay, Now let us take another example. Now, take this example. Suppose a few words, for example, Get full on. You can see that this is a function. Similarly set phone is also a function. No, My requirement is that I should match this. Parentis is here only. And only if we have either get phone part, set phone before that. So how you can create a regular expression for that? Okay, So what? I'll do it. I should have forgetful our sat phone before this parent has this, right? So I just right here. Question Mark, Listen, um symbol on equal, right? And I just say, get for Greg. So this is a one off my criteria, so you can see that it has mark these two. And what I'll do is just use this pipe symbol and I'll just use another positive look being a system. So I'll just give you a Christian MMA, Liz, that equality and set beer to any four. Right? So it has might all these four and basically let me mark this and an entire group, so I'll just create a group. And what I'll say is I should have either this world called Get phone are set for just before this parentis is right. So I just say, backs less. And for this opening off parentis is I'll just use this opening off Prentice's. And please note that again. I have just given this back class for that. It becomes a little character. Okay, Again, I'll just give backs less, and I'll just give closing off. Parentis is right. And you see that it has masked this particular parent tests as well as this particular parentis is right. Okay, let me give a small exercise to you. So I have this part clear fight. Okay. So you can see that it has these details, right? For example, so many fine aims. It has either it instead start txt or not, pdf or jpg or nor pity or even we have dot Do you see? That is dogfight. Right now my requirement is that I want to match this work. For example Jpg Onley If we have the word called image one before this, so can you please pause this video and write the regular expression for this? I guess you have written the regular expression correctly and let me just give the answer here. So basically, I want image one to be like, look behind assistant. Right? And this has to be positive. Look, being a person, so I'll just give your question mark less than symbol. Then we have this acquittal and I just give image one right? And let me just give backs less dark. Okay, on just close this So it has marked despite clip list. You can see that this is the marking here. And then what? We can do it. We can just give gpt. Right? So this has capture this word J p e g. And this is the extension off this particular fight That is immutable. Okay, So my requirement for us to capture the extent child, if I only if the finally is image one right, so you can see that you can achieve this by just using positive. Look behind assistant. All right, so we have taken enough example off positive. Look, being a certain so please keep on practicing on. Let us close the session. Your it'll times for connecting by. 44. Negative Lookahead Assertion-Part 1: Hello and welcome back. Let us understand about negative look ahead system. So in this example, suppose I want to capture the world after which Doc txt does not occur. So what I'll do is basically I want to capture worse like e m p d t. From this. Because after this, we have dark Pdf on this dark period is not Doc txt So basically you see here we have a pm pdt dot dog on dhere dot txt does not come so we can capture this word as well. Similarly, here it is dark, ppd, so we can capture this word as well, right? So in this case, we will use negative look ahead. That's awesome. That means captured the world. For example this word on Lee and only if this part clear word that is dot txt does not occur. Right? So this is the case here, here and here. So let us right the regular expression for that. So instead of equal symbol, I will just use exclamation mark, That's all. And you see that it has captured this am PDT again. It has captured this MPD two here and am PDT here as well, right Now let us take another example. So here Suppose I want to capture only set phone and get full. That means I want to capture only doth words after which we do not have this opening and closing off this parent assessed together. So what I'm going to do is I just use this exclamation mark you and you see that it has captured this sat phone and get food. Okay, let's take another example on this time I want to capture all those words after which we should not have a space and cord. So this time I want you to do this is very simple Presuppose this we do and trying on the system. I know that you are able to do this so I'll just put an exclamation mark here. And you see that it has captured on Lee This shower a steam ill and pulled right on it are not captured this job this estimable dis est email and then this But so Doctor I heard in this negative Look ahead a system. I will see you the next we do. Listen Take care. Bye. 45. Negative Lookbehind Assertion: Welcome back. Let us understand what is negative. Look behind a certain we know that negative Look, being a certain is represented by a question mark. Less than symbol at exclamation mark. Right. So let us take for examples of this. So here you can see that I have the same example. And last time I was looking to capture the world called Cord only and only if we have Java with the space. Right now let us capture the world core Onley. And only if we don't have Java before that. So it is very simple. We have to just remove this equality and I'll just give exclamation Mark and you see that it has captured the score from this HTM and then this court from this HTML. But so basically what it says is I'll capture this word. Corkboard and I will capture this only. And only if this work that is Java. That space is not consent. Right? So this will not be included in my such. And I'll just get code from this particular example. And I just captured the score from this particular example. Now, in this particular example, if I just use this exclamation month. You see that this time it has captured this DPT Not this dpt And again the reason is very simple. What it says is before the sort Dpz There should be no word but the name image one So that is the reason it has not selected this And here we have image to right and that is the reason it has selected this jpg Now let us take one exercise. So in this particular example what I'll do is let me just add another method So I just stay up to date for that is you biddy bee it going And now this time what I want is before these parentis is If we have get full or if I have set full then please do not capture that particular parent it is apart from that kiss you can capture that Prentice is if you have any other matter name for example If it is having update full then you can capture this parenthesis. But if you have get full are if you have the name sat phone before this parenthesis Please do not capture this parentis is so. Can you please pause this video and write the regular expression for this particular example. All right, I think you are able to understand what I'm trying to say. So if I just give you exclamation mark, and if I just give you exclamation mark, you see that it does not able to capture the result which we were expecting because it has captured the 1st 1 the 2nd 1 and 3rd 1 as well. Now, can you please tell me what is the reason for this? Okay, so let me give you the reason for this in case we have not figured it out. Okay, So what happens is this particular parentis is is Onley masked? If there is no get phone are there is no set for right? Consider you have only this particular get phone. That is from here to here. Okay? And you have not got any set phone. So if you just like this particular value, that is this particular negative look behind us. Awesome. Then by default, it will also capture this particular set for right, So let me show you find Just remove this. I just remove this. You see that test captured this set phone as well, right? If I just keep it at him and let me remove this. Get full listing. So if I just remove this, get phone. What happens is it will try to match this get for national But it will not match this 61 So just remove this today it has masked this Get foot. You're beautiful because you have just given set for me. So what happens is you have given here logical or right? This is like you can see. Here it is. It acts like a 1,000,000,000. Or in this automation they should not be true and they should not be cool. But here we're using this or a brick. And due to this logical or over it. Or you can say that this is like brilliant or operator do this 1,000,000,000 or operator, you're targeting their desire desert. So let me just remove this 1,000,000,000 are on. You can see that it has captured this particular parentis successfully. So this is a classic example off How you should carefully desk your regular expressions properly. For that you should not get unexpected better in future. Right? So we have all listening positive. Look, hit a person we have seen negative look ahead assertion. You have also seen positive look behind assassin on. We have taken enough examples off negative Look behind a certain as well. So this marks the end off this section.