 Quantifiers are essential for both understanding and using regular expression effectively. It is actually a critical feature of regular expression. It allows you to do a number of things. Quantifier specifies how many instances of character, group or character class present in the input for a match to be found. It means it allows you to repeat characters, meta characters and an entire sub expression in the regex. So if you don't know exactly how many characters are coming, you can use quantifiers. So there are four different syntaxes available to indicate the repetition in regular expression. The first three are single character quantifiers. The first quantifier is the plus sign and what it allows you to do is to match the previous character one or more times. There is no limit on how many times it can match. This can be used when you want to find at least one instance and you want to make sure that it's there. But you don't care how many times it repeats. We will take a closer look at that in the demo. The next meta character is a Stric or Star which is used to match zero or more instances of the previous character. You do have to be careful when using this meta character because it does allow zero instances of match to be found which basically makes it optional and it will match anything. The only difference between the star and the plus sign is the plus requires at least one match to be found otherwise it will fail the match. And the next meta character is the question mark which is used to match previous character zero or one time. Means it allows you to make a match optional. At the star character the question mark only allows one instance of the match to be found. Now the next three meta character sequences allow you to specify the number of matches by providing a minimum or maximum value. It provides us with more precision as it allows us to indicate the exact quantity we want to match. So to specify the exact number of matches you would place them inside two curly braces which matches the previous element exactly n times. Here n is a non negative number and the next is say if you want to match something at least n number of times then what you need to do is in curly brace specify the number followed by comma and then closing the curly brace which indicates match something minimum n times and then very last quantifier that I have listed here which allows you to specify a minimum and maximum number of matches to be found. So this expression would find a match where there is at least n character or minimum n character but not more than m characters. This are an extremely useful meta characters but the downside of this expression are they can get complex very fast. Look at this sample rejects. It simply match the valid email address but look at this crazy expression that you found on the internet. So I think this is why people stay away from the regular expression because it appears very complex at first if you don't have any fundamental knowledge of any of the meta but luckily you are not because you are watching this course. Alright now let us move on to the demo so you can learn how to use this quantifiers in your expression. Alright so this is one of the great regular expression testing tool provided by Byte Scout. In this demo we will see the power of plus quantifier or star quantifier. Quantifier matches 0 or more character plus quantifier matches 1 or more character. Here in the input text I have defined this word. Now to match this word I will use the dot meta character. Now the period or dot meta character that will match anything except the newline character. So here to match the whole word I need to repeat it 9 times so that it will match the whole word. So here as you can see that it now matching the entire string but wouldn't it be great if I didn't have to repeat that period 9 times well luckily that's exactly when you would want to use quantifiers. So say for example if I remove it and if I add the star or plus quantifier over here then we will get the same output. So we reduced our expression from 9 characters to 2 characters. Now let me tell you one thing it is dangerous to use period or dot because you are matching anything 0 or more times so it will match absolutely nothing. So you have to be careful when you use the period which matches anything with a quantifier. Now let's take a look at the another demo. Say there are 3 words user, users and users with 3s. And I want to match only top 2 words user and users. It means I want to make this as optional. So let us write the rejects to match the first 2 words or to get the first 2 words. If I write users over here then it will give me the last 2 words. But what I want is I want to get the first 2 words. So to get the first 2 words here I need to make this as optional. So to make it as optional I need to add question mark quantifier. So once I add the question mark quantifier it will started matching the all these 3 words. So let me end the anchor over here. So see now I am getting the expected output which I want. And as you can see from the output the one with the 3s is not returning. So this is how you can use the question mark quantifier. Now let's move on to the some another example. So now here in the input string I have added one sentence like this. Now say in this sentence I want to match the word which ends with the UT character which is over here and over here. So let me write the rejects to get that 2 words. So say if I define the character range with plus quantifier then it is started giving me all the word from this sentence. But what I want is I want to find the word which ends with the UT character. So let me write the character UT. So now you can see that it will started giving me the expected output which we want. Now let us move on to some practical examples of quantifier. Alright so here in the input text I have defined the possible format of phone numbers. Now let us write the rejects step by step to match this phone number. But first let us analyze the pattern here this round bracket is optional. Now this phone number may contain hyphen or it may contain dot or it may contain a space. So first we will write the rejects for this pattern and then after this pattern and then after this pattern and this number is followed either by hyphen or dot and space. So we will also handle this scenario in rejects. So first let us write the rejects for this pattern. Here as I said this round bracket is optional. So first let us define the round bracket to make it optional. I can either use range character like this 0 comma 1 or I can use question mark character and then we will define the numerical range which is 0 to 9. But here I want to match only 3 digits so I will add that length followed by closing round bracket and this round bracket is also optional. So let me add the question mark quantifier over here. Now as I said this phone number either contain hyphen dot or space. So let me add that character in character class hyphen dot and space and now we will match this next 3 digit number. So for that let me add the numerical range 0 to 9. Now after this number there may be again hyphen space or dot. So let me add that same. Now let us write the rejects for this 4 digits 0 to 9. So now it started matching the phone number as expected. Alright now let us walking through what this expression is meaning. It start off with the round bracket meta character followed by a question mark because round bracket may be optional over here and it does the same thing for the closing round bracket. The next part of the expression is number range meta character looking for exactly 3 digits. Now this is going to match these 1 2 3 part of the number. After those 3 digits it is looking for either hyphen or space or a dot and then another 3 digit which matches 4 5 6. Right after the second set of 3 digits there is another hyphen or space and dot and then another number range looking for exactly 4 digits. This part of the expression matches 6 7 8 9. Fair enough right. Now let us move on to the next fundamental which is short chord.