1 00:00:01,210 --> 00:00:07,660 Biton regular expressions, so this is a very important concept, the very important feature in Python 2 00:00:07,660 --> 00:00:08,170 programming. 3 00:00:08,800 --> 00:00:15,970 So let us go to some practical examples to show you that how these regular expressions can get embedded 4 00:00:16,210 --> 00:00:17,560 using our python coding. 5 00:00:17,740 --> 00:00:19,210 So what's the demonstration? 6 00:00:19,210 --> 00:00:27,310 No regular expression in Python is a very powerful tool, and regular expressions allows us to locate 7 00:00:27,310 --> 00:00:29,980 and change strings in a very powerful ways. 8 00:00:30,460 --> 00:00:36,400 And they work in almost exactly the same way in every programming language as well. 9 00:00:37,030 --> 00:00:43,660 So regular expressions, that is, the regex are used to search for this specific string in a large 10 00:00:43,660 --> 00:00:50,680 amount of data, verify that a string has the proper format in case of email from a checking phone for 11 00:00:50,710 --> 00:00:52,180 from phone number format checking. 12 00:00:52,180 --> 00:00:58,640 We can use this regular expression and find a string and replace it with another string format data 13 00:00:58,660 --> 00:01:02,940 into the proper format and for importing, for example. 14 00:01:03,190 --> 00:01:07,270 So there are different cases where this regular expression can be used. 15 00:01:07,870 --> 00:01:10,230 So important the model. 16 00:01:10,240 --> 00:01:17,880 So for that one will be using import Ardie and let us suppose we are to find this for a particular match. 17 00:01:18,130 --> 00:01:20,520 So such for a B in the string. 18 00:01:20,920 --> 00:01:24,010 So if I read such a piece. 19 00:01:24,010 --> 00:01:29,560 So here we are having the string EBP and the respective string in which we will be doing the searching. 20 00:01:29,560 --> 00:01:32,080 Is that the it was at the apex. 21 00:01:32,620 --> 00:01:38,540 So now if we do this searching, we are finding that there is and if so, when this particular added 22 00:01:38,590 --> 00:01:42,700 or such return are true, then this respective message will get printed. 23 00:01:42,730 --> 00:01:44,260 So let me go for the execution. 24 00:01:44,890 --> 00:01:47,350 You can find that it is getting printed accordingly. 25 00:01:47,750 --> 00:01:54,580 If I go for this one, say, EPB in that case, then obviously the message will not get printed because 26 00:01:54,580 --> 00:01:56,080 it is returning false it. 27 00:01:58,390 --> 00:02:03,370 So that is added such there is a search for a certain string into another given string. 28 00:02:04,000 --> 00:02:10,900 Next, we are going for this one, so we're going to find all this function returns a list of matches. 29 00:02:11,200 --> 00:02:14,910 So Dotty's it to match any one character or Artisphere. 30 00:02:14,930 --> 00:02:21,820 So Dot Will is nothing but one wildcard character, which will be denoting any single character or espace. 31 00:02:22,300 --> 00:02:24,610 So all is equal to Odegaard. 32 00:02:24,610 --> 00:02:26,980 Find all so a dot. 33 00:02:27,280 --> 00:02:31,920 That means that he can have any, any character, any one character or space. 34 00:02:32,390 --> 00:02:34,350 The ape was at the apex. 35 00:02:34,360 --> 00:02:36,160 So if it is the main string. 36 00:02:36,370 --> 00:02:44,820 So for I in all apes, if you go for preened I can get this one as a blank space and apex. 37 00:02:45,010 --> 00:02:51,130 So in this way I'm getting the respective matches, that is, find all returns, all the list of matches. 38 00:02:51,310 --> 00:02:57,880 And here this dot is being used as a wildcard character denoting a single character or space. 39 00:03:00,350 --> 00:03:06,950 Next, we are going for this find Easter, which returns and iterator of matching objects and you spend 40 00:03:06,950 --> 00:03:08,280 to get the location. 41 00:03:08,750 --> 00:03:14,450 So now here you see it is the mainstream, given that it was at the apex and then we're having this 42 00:03:14,540 --> 00:03:16,680 in order to find it. 43 00:03:17,150 --> 00:03:19,830 So now it is returning one iterator. 44 00:03:20,120 --> 00:03:25,310 So that's why we're having this EPEAT dot Dortmund's any character does exist here. 45 00:03:25,340 --> 00:03:26,460 So these are mainstream. 46 00:03:27,020 --> 00:03:29,840 So here we are having some matches and we can get it. 47 00:03:30,170 --> 00:03:36,020 The respective value that is either spent so from which character to which character it is and getting 48 00:03:36,320 --> 00:03:36,990 extended. 49 00:03:37,250 --> 00:03:40,130 So there is a long table and then print locked up. 50 00:03:40,540 --> 00:03:42,480 They are getting printed as a table here. 51 00:03:42,710 --> 00:03:46,720 So now you are also printing the substring from the estimate. 52 00:03:46,940 --> 00:03:50,050 So there is a locked up colon locked up one. 53 00:03:50,060 --> 00:03:56,270 So in this way you are just going for the printing locked means the first index and the locked up one 54 00:03:56,270 --> 00:04:01,740 means the second index and the second index is always exclusive and the first index is inclusive. 55 00:04:02,150 --> 00:04:04,520 So let us go for further explanation one second. 56 00:04:04,550 --> 00:04:06,040 So let me my coat here. 57 00:04:06,560 --> 00:04:07,930 We are getting the output like this. 58 00:04:08,210 --> 00:04:10,750 So now you see when you are printing this locatable. 59 00:04:11,000 --> 00:04:16,300 So first time I'm getting this match ranging from character number four to number eight. 60 00:04:16,700 --> 00:04:17,920 So just come to here. 61 00:04:17,930 --> 00:04:19,100 So it is my character. 62 00:04:19,100 --> 00:04:19,970 Number zero. 63 00:04:19,970 --> 00:04:21,380 One, two, three. 64 00:04:21,800 --> 00:04:24,460 So four, five, six, seven. 65 00:04:24,470 --> 00:04:25,790 So eight is exclusive. 66 00:04:26,150 --> 00:04:29,540 So here we are having the string that is a idot. 67 00:04:29,690 --> 00:04:32,400 So that's what I'm including this blank space here. 68 00:04:32,900 --> 00:04:34,160 So that is my seven. 69 00:04:34,190 --> 00:04:40,670 So eight, nine, 10, 11, 12, 13, 14, 15, 16, 17, 18. 70 00:04:41,150 --> 00:04:46,710 So now we are having this 19, 20, 21, 22, 23 is exclusive. 71 00:04:46,910 --> 00:04:48,240 So that's why I'm getting this one. 72 00:04:48,590 --> 00:04:50,420 So anybody are going for this locked up? 73 00:04:50,420 --> 00:04:50,900 Allegedly. 74 00:04:50,930 --> 00:04:55,290 I'm just retrieving for colon locked up one I'm getting at here. 75 00:04:55,430 --> 00:05:00,650 So four to eight, that means all the characters ranging from location number four to seven will be 76 00:05:00,650 --> 00:05:08,900 printed, will be read as a substring now match one or several letters, square brackets, square brackets 77 00:05:08,900 --> 00:05:16,070 will match any one of the characters between the brackets, not including apparently work Verity's unless 78 00:05:16,070 --> 00:05:17,100 they are listed. 79 00:05:17,450 --> 00:05:21,170 So now here having on one string that is the animal state. 80 00:05:21,440 --> 00:05:24,560 So all animals is equal to adopt find. 81 00:05:24,830 --> 00:05:29,840 So now you can see here we have having list of characters so any one of them can be picked up. 82 00:05:30,140 --> 00:05:33,140 So C are if P so. 83 00:05:33,410 --> 00:05:40,160 So the strings actually does have strings for the matching actually apostacy at the art at the Imit, 84 00:05:40,160 --> 00:05:41,960 DFAT and Bayati. 85 00:05:42,410 --> 00:05:44,170 So that will be sorted in the mainstream. 86 00:05:44,180 --> 00:05:47,570 That is the animal listed so far in animals. 87 00:05:47,570 --> 00:05:48,970 All animals are beginning. 88 00:05:48,980 --> 00:05:56,000 I said go on printing this I so you see we're getting this one as Areti because it is there an oddity. 89 00:05:56,330 --> 00:05:58,970 Is that substring to be starts to šemeta. 90 00:05:58,970 --> 00:06:05,870 If it didn't we have got this one, but capital C.A.T. is not coming because Capital C is a different 91 00:06:05,870 --> 00:06:07,150 character from the small C. 92 00:06:07,670 --> 00:06:13,580 So in this way we are getting this idea that how we can enclose multiple characters with the Heartbreakers, 93 00:06:13,580 --> 00:06:18,590 which will indicate that any one of the characters can be taken from these characters, including within 94 00:06:18,590 --> 00:06:19,430 the third bracket. 95 00:06:22,950 --> 00:06:29,670 We can also allow for characters in range, remember to include apparently workers letters as required. 96 00:06:29,670 --> 00:06:36,160 So animal is still essential to this and some animals is able to adopt, find all so to. 97 00:06:36,630 --> 00:06:42,420 That means CDE up to a lower case and see to him in the upper case and see it. 98 00:06:43,050 --> 00:06:44,050 So now 80. 99 00:06:44,070 --> 00:06:50,010 So now we are having this Attisso C.A.T. will have the match here and then we're having this M80 will 100 00:06:50,010 --> 00:06:53,170 have dementia and if it will have to match it. 101 00:06:53,190 --> 00:06:59,240 So, but it is not having the match because B is not included in this, in this rangers'. 102 00:06:59,610 --> 00:07:04,690 So now in this way, if we go on printing, I'm getting this Katsumata and F.T. are getting printed. 103 00:07:04,710 --> 00:07:05,960 I'm just executing my code. 104 00:07:05,970 --> 00:07:07,020 You are getting my output. 105 00:07:10,060 --> 00:07:16,870 Use this opportunity to denote any character, but whatever characters are between the brackets, so 106 00:07:16,870 --> 00:07:22,570 there is any character but what the characters between the brackets, so so now we're here to see we're 107 00:07:22,570 --> 00:07:26,910 having the CNR within the third bracket and there's not symbolist there. 108 00:07:27,160 --> 00:07:31,940 So other than CNR, so rest of the patterns will be saadet here. 109 00:07:32,320 --> 00:07:39,060 So as a result of that, C.A.T. not becoming an oddity, not becoming in the output, but Imit, DFAT 110 00:07:39,070 --> 00:07:42,090 and Petie can have their matches. 111 00:07:42,400 --> 00:07:44,430 So for I in some animals. 112 00:07:44,430 --> 00:07:48,700 So if you go for print, I'm getting the support that is šemeta if at the end. 113 00:07:48,720 --> 00:07:50,580 Bayati so I'm executing my code. 114 00:07:50,590 --> 00:07:51,520 You are getting the output. 115 00:07:52,890 --> 00:08:00,900 Replace all Matyas, so replace matching items in a string, so all food is this, that is a get met 116 00:08:00,900 --> 00:08:06,670 and bet you can compile a rejects into pattern objects which provide additional methods. 117 00:08:07,020 --> 00:08:10,310 So that is the Odegaard compile, see are it. 118 00:08:10,400 --> 00:08:13,520 So actually we are having this Siete and Arrietty. 119 00:08:14,100 --> 00:08:17,770 So now at having this sub that is, that is actually a substitute. 120 00:08:17,970 --> 00:08:24,790 So Sabry places items that that rejects in the string with the first attribute string bass to the sub. 121 00:08:25,140 --> 00:08:27,870 So now you see up all the rejects. 122 00:08:28,470 --> 00:08:29,660 That is a substitute. 123 00:08:30,090 --> 00:08:37,000 So this wholefood actually this old fool is the main string here and all will be the replacing one and 124 00:08:37,000 --> 00:08:43,050 rejects has got has got initialized with this has got combined with the C.A.T. and Arrietty. 125 00:08:43,470 --> 00:08:49,350 So the C at the end will be replaced by W.L. but empty and will remain as it is. 126 00:08:49,380 --> 00:08:55,290 So now when you are printing this out fool I'm getting this out Matt and bet I think you are getting 127 00:08:55,290 --> 00:08:55,950 my idea. 128 00:08:58,890 --> 00:09:05,330 Next one is about solving backslash problems, so radix, it was the backslash to designate the special 129 00:09:05,330 --> 00:09:10,030 characters and the python does the same insert strings, which causes issues. 130 00:09:10,400 --> 00:09:14,540 So let us try to get this lessler stuff out of this out of a string. 131 00:09:14,750 --> 00:09:17,220 So now here, see, this is my string to be searched. 132 00:09:17,600 --> 00:09:20,570 There is a slash slash stuff, the string to be searched. 133 00:09:20,960 --> 00:09:24,980 So random, mysterious here is less, less stuff. 134 00:09:25,370 --> 00:09:32,000 But if you go for this Adidas Suchi, there is just less, less stuff into the indie register. 135 00:09:32,090 --> 00:09:35,680 If you go on searching, it will find nothing here I can show you. 136 00:09:36,590 --> 00:09:37,370 So it is fine. 137 00:09:37,380 --> 00:09:43,130 Nothing because here this stuff is not the same, whatever we are thinking about. 138 00:09:43,490 --> 00:09:48,260 So in that case, what you can do that to have a slash in my pattern I should use double slash. 139 00:09:48,680 --> 00:09:52,370 So to have double slashes in my pattern I should use false eyelashes. 140 00:09:52,670 --> 00:09:56,800 So is a floor for slash characters we have included and then stuff. 141 00:09:57,110 --> 00:09:58,980 Now we are going to get our output here. 142 00:09:59,120 --> 00:10:02,540 So now you're getting a here and the span is eight to 14. 143 00:10:03,470 --> 00:10:05,270 So this thing can also be written. 144 00:10:05,270 --> 00:10:11,960 Using this one with R stands for the rogering so you can get around this by using the drawstring and 145 00:10:11,960 --> 00:10:15,200 we don't treat backslash as a special character. 146 00:10:15,210 --> 00:10:18,590 So now you see here are stands for the real string. 147 00:10:18,590 --> 00:10:24,650 So now when you are putting this, you are getting the same output as we had in case of four times before 148 00:10:24,650 --> 00:10:26,840 stuff in the third string. 149 00:10:28,470 --> 00:10:35,360 So matching any character is soldat dogmatists, any character, but if we want to match a period, 150 00:10:35,430 --> 00:10:37,950 there is a backslaps period will be used there. 151 00:10:38,190 --> 00:10:41,970 So just consider this one at having this, if not be what I thought. 152 00:10:42,240 --> 00:10:45,250 I thought our dot is DOT and CIA. 153 00:10:45,540 --> 00:10:47,030 So now we are going for this match. 154 00:10:47,040 --> 00:10:51,680 That is that Dortmund's any character and dark means a dot. 155 00:10:52,230 --> 00:10:58,230 So then DOT is any character and the Slashdot means a dot and it means any character. 156 00:10:58,260 --> 00:10:59,250 So this is a pattern. 157 00:10:59,250 --> 00:11:01,290 I've given this a regular expression I've given. 158 00:11:01,650 --> 00:11:06,450 So I will be searching in this random esteve so array in the auto industry. 159 00:11:06,480 --> 00:11:10,230 So it'll be searching and Hyrule getting to matches and then nothing. 160 00:11:10,230 --> 00:11:18,340 But if it be dot I and I thought our dot is so obviously CIA, they are not having the dots in between. 161 00:11:18,480 --> 00:11:20,970 So that's why that is not getting a perfect match. 162 00:11:21,360 --> 00:11:24,150 So the first part is indicating any character. 163 00:11:24,160 --> 00:11:29,890 So as a result of that if is getting tested and then Slashdot is actually not a dot here. 164 00:11:29,910 --> 00:11:33,940 So this is there and then another dot is denoting any characters. 165 00:11:33,940 --> 00:11:38,070 So having a match there and Slashdot denotes another dot. 166 00:11:38,100 --> 00:11:40,800 So this is getting messed here and here. 167 00:11:40,800 --> 00:11:45,720 We're having this dot and that is the only thing that can be matched with this idea. 168 00:11:45,750 --> 00:11:52,860 So that's why if Dot brought I and I thought our dot s idot our dot is to Métis, I'm getting hit. 169 00:11:55,780 --> 00:12:00,320 So now going for this matching white space so we can match any Wildsmith character. 170 00:12:00,730 --> 00:12:04,280 So here we are having this again around is physicalities. 171 00:12:04,300 --> 00:12:06,930 So we have one for this multiline here. 172 00:12:07,240 --> 00:12:10,870 So Print Rende starts to print their respective string here. 173 00:12:10,870 --> 00:12:14,140 You can find that it will print the respective string letters. 174 00:12:14,140 --> 00:12:14,900 Go for this. 175 00:12:15,730 --> 00:12:17,810 Yes, the string has got printed. 176 00:12:17,830 --> 00:12:22,670 Now, what we're doing here, that means we're going for this at compile selection. 177 00:12:22,810 --> 00:12:27,330 So there is a new line character and rejects that substitute. 178 00:12:27,760 --> 00:12:32,790 These particular discussion will be replaced by this single spaced here. 179 00:12:33,070 --> 00:12:39,310 So as a result of that financial print is registered, the total line will get printed in the same line, 180 00:12:39,520 --> 00:12:42,640 in the same row with a blank space as a separated. 181 00:12:43,640 --> 00:12:49,980 So you see the same, same the phone line has got painted with a blank space as a separator, so here 182 00:12:49,980 --> 00:12:56,690 you see in between long and string there was a slash and now it is being replaced by a blank space. 183 00:12:56,840 --> 00:13:03,890 And then between the goes and on, we had one slash in here, but it has been replaced by a single blank 184 00:13:03,890 --> 00:13:04,280 space. 185 00:13:04,910 --> 00:13:06,640 So now let us go for the next one. 186 00:13:06,650 --> 00:13:07,910 That is a match. 187 00:13:07,910 --> 00:13:16,010 Any single number, any single number so they can be used instead of 029 and slash capital D is same 188 00:13:16,010 --> 00:13:17,970 as not 029. 189 00:13:18,350 --> 00:13:21,590 So here we're having this is still one, two, three, four, five. 190 00:13:21,600 --> 00:13:27,280 So if we want to have a perfect match, then I can go for this added dot find all slash D. 191 00:13:27,350 --> 00:13:33,240 That means we are searching for this any digit at any digit in this random store. 192 00:13:33,270 --> 00:13:37,370 So I'll be getting a match for the fight, then I'll be getting a match here four to five. 193 00:13:38,180 --> 00:13:40,550 So now you see if they print this one again. 194 00:13:43,320 --> 00:13:44,310 Without this, Lynn. 195 00:13:47,560 --> 00:13:53,680 So if I go on to executing this, I can find that I'm getting this match for five times or five different 196 00:13:53,680 --> 00:13:54,250 digits. 197 00:13:55,980 --> 00:14:02,580 Matching multiple numbers so you can match multiple digits by following this, following this with that 198 00:14:02,580 --> 00:14:03,640 number of values. 199 00:14:03,960 --> 00:14:11,310 So here to see where having the match five numbers only so we can go for this D five and then one, 200 00:14:11,310 --> 00:14:12,240 two, three, four, five. 201 00:14:12,570 --> 00:14:17,010 So now if we go for the execution, you can find that this is it is a zip code. 202 00:14:17,010 --> 00:14:20,890 That means here we're heading we're having this particular match here. 203 00:14:20,910 --> 00:14:22,430 We're having this particular match here. 204 00:14:22,710 --> 00:14:25,380 So that's why our such is returning. 205 00:14:25,380 --> 00:14:31,950 A true here slash denotes any digit and five denotes the right number of digits. 206 00:14:32,010 --> 00:14:34,500 So here we are having five number of digits out there. 207 00:14:34,680 --> 00:14:35,620 So that's a here. 208 00:14:35,650 --> 00:14:36,780 We're going to get a match. 209 00:14:36,790 --> 00:14:39,490 Yet if you put a character here, if you put a character. 210 00:14:39,510 --> 00:14:43,260 So if it go for the execution, you see it is a zip code. 211 00:14:43,260 --> 00:14:45,620 That text is not getting printed. 212 00:14:45,900 --> 00:14:49,880 So because that is not a perfect match, you are having one alphabet in between. 213 00:14:50,400 --> 00:14:52,460 So you can also match within the range. 214 00:14:52,470 --> 00:14:56,780 So the match values that are between this five to seven digits. 215 00:14:57,210 --> 00:14:59,090 So he had the main string here. 216 00:14:59,400 --> 00:15:04,440 So now we can go for this, find all that is a slash D that is there any digit. 217 00:15:05,100 --> 00:15:08,690 That range will be five or seven, five or seven. 218 00:15:09,030 --> 00:15:12,130 So as a result of that here we're having this five digits. 219 00:15:12,420 --> 00:15:14,100 So now let's go for this match. 220 00:15:15,620 --> 00:15:21,290 So in between this fight in between five and seven, that means in between five, six, seven, I mean 221 00:15:21,650 --> 00:15:23,890 three lengths are physical. 222 00:15:24,050 --> 00:15:26,110 So that's why I'm getting this matchup three. 223 00:15:26,570 --> 00:15:29,070 So here you see we're having this is a perfect match. 224 00:15:29,090 --> 00:15:30,260 This is a perfect match. 225 00:15:30,260 --> 00:15:31,760 And this is also a perfect match. 226 00:15:32,090 --> 00:15:33,450 It has got a length of five. 227 00:15:33,470 --> 00:15:34,710 It has got a length of six. 228 00:15:34,730 --> 00:15:36,060 It has got a length of seven. 229 00:15:36,350 --> 00:15:38,660 So five common seven means five to seven. 230 00:15:39,020 --> 00:15:46,690 That means all the numbers consisting of digits only and having five to seven digits. 231 00:15:46,700 --> 00:15:51,100 That means five digits or six or seven digits will have the match here. 232 00:15:54,000 --> 00:16:00,870 Matching any single letter or number in that case, we can go for a slash W that is the same as A to 233 00:16:00,870 --> 00:16:09,240 Z small letters, A to Z in capital letters and 029 So that is there any letter or a number but slash 234 00:16:09,240 --> 00:16:12,390 capital W denotes a note of them not. 235 00:16:12,390 --> 00:16:13,770 There is a note we are having here. 236 00:16:14,430 --> 00:16:18,540 OK, so we are having on also the underscore is included here, also the underscore. 237 00:16:18,720 --> 00:16:24,630 So now we are having this phone number that is for one to hyphen five five five Haibane one two, one, 238 00:16:25,050 --> 00:16:25,310 two. 239 00:16:25,770 --> 00:16:29,640 So check if it is a phone number or not so we can go for the slash W. 240 00:16:29,640 --> 00:16:36,420 That means that any letter or number, along with the underscore and having the Lintott three, then 241 00:16:36,420 --> 00:16:43,500 one hyphen, then any number or letter we're having this with that we do of three. 242 00:16:43,500 --> 00:16:49,510 That means the three number of such then hyphen and then slash W4 and then phone number I've given. 243 00:16:49,530 --> 00:16:53,200 So it is a valid phone number, so it is a phone number so that we could print it. 244 00:16:53,820 --> 00:16:58,870 So now we can have this check for first name between two and 20 characters. 245 00:16:58,890 --> 00:17:02,400 So first name must be in between two and 20 characters. 246 00:17:02,410 --> 00:17:11,100 So any, any, any name we just having two letters or C two, 20 letters, not only letters. 247 00:17:11,100 --> 00:17:15,850 We are having these letters or numbers or digits will be treated as a valid one. 248 00:17:16,020 --> 00:17:25,020 So if added or such, slash w w denotes small little small Z capital to Capital Z and 029 and also to 249 00:17:25,020 --> 00:17:29,940 underscore so the length will be ranging from two to 20 inclusive of them. 250 00:17:29,940 --> 00:17:31,130 And then Alterman. 251 00:17:31,560 --> 00:17:32,910 So now it is a valid name. 252 00:17:32,920 --> 00:17:37,470 Yes, it has got a valid name because it is having a length which is in between two to twenty. 253 00:17:40,940 --> 00:17:47,230 So now here we are having this white space, so this is same as this and slash capitalis is same as 254 00:17:47,240 --> 00:17:48,260 not of this. 255 00:17:48,680 --> 00:17:49,810 So he can go for this. 256 00:17:49,810 --> 00:17:58,160 So added or such there is there any letter or any digital, including an inclusive underscore having 257 00:17:58,160 --> 00:18:01,600 the length in better from two to 20 and then slashes? 258 00:18:01,610 --> 00:18:08,870 That means that any, any, any one of them we can have and then two to 220 will be the next next number 259 00:18:08,870 --> 00:18:11,540 of letters are the digits are underscored. 260 00:18:11,560 --> 00:18:13,700 Now here is a name we are giving. 261 00:18:14,090 --> 00:18:17,210 So now I shall have to print whether it is a valid full name or not. 262 00:18:17,220 --> 00:18:20,950 Yes, it is a valid full name because it is having the land in between to 220. 263 00:18:21,350 --> 00:18:23,720 It is also having the land in between to 220. 264 00:18:23,720 --> 00:18:25,300 And that is a blank space, is there? 265 00:18:25,580 --> 00:18:26,810 So there is a white space. 266 00:18:26,810 --> 00:18:27,520 We are having it. 267 00:18:27,770 --> 00:18:31,990 So that's why we are having a match and that's why it is a valid fullname. 268 00:18:32,060 --> 00:18:34,340 The respective message is getting printed. 269 00:18:35,480 --> 00:18:40,280 So next one is this one, so now plus matches for one or more characters. 270 00:18:40,490 --> 00:18:42,910 OK, so now we're going for this E-Plus. 271 00:18:42,920 --> 00:18:46,520 That means a single letter A or more than that. 272 00:18:46,940 --> 00:18:50,710 So we are having this is a Buji. 273 00:18:50,720 --> 00:18:52,850 So obviously Buerge is not starting with this. 274 00:18:53,570 --> 00:18:56,600 So now if you go for this Odegaard, find all. 275 00:18:56,600 --> 00:19:04,130 If you go for this or you can go for this, you can have the three matches or a four is for a B and 276 00:19:04,130 --> 00:19:05,950 you can print a match just like this. 277 00:19:06,320 --> 00:19:13,430 So because they are having the first letter A next, it may or may not have one or more characters. 278 00:19:15,080 --> 00:19:20,110 So here we are having this import, Ardino, here we are going for the email address checking. 279 00:19:20,150 --> 00:19:21,320 So that is very important. 280 00:19:21,560 --> 00:19:24,260 You know, most of the projects we might be requiring these regular. 281 00:19:24,750 --> 00:19:28,250 So let me discuss them into some rules. 282 00:19:28,580 --> 00:19:32,780 So create projects that matches email addresses from a list. 283 00:19:33,260 --> 00:19:38,690 And the first criteria will be that one to 20 lowercase and uppercase letters, numbers plus. 284 00:19:39,080 --> 00:19:44,030 And then dots underscore we are having this percentage plus and minus. 285 00:19:44,660 --> 00:19:46,590 So it will be represented in this way. 286 00:19:46,610 --> 00:19:49,870 So that is a slash W then DOT underscored. 287 00:19:50,150 --> 00:19:54,270 But having this one as your percentage plus and minus. 288 00:19:54,500 --> 00:19:56,790 So that is a there's a first one. 289 00:19:57,110 --> 00:20:01,030 Next will be having this is added up symbol. 290 00:20:01,050 --> 00:20:02,620 So symbol is this one. 291 00:20:03,080 --> 00:20:08,390 So that means this one is for the rule number one as it has been mentioned, that it can contain lowercase 292 00:20:08,390 --> 00:20:16,280 an uppercase letters numbers, plus it can have this dot, then underscore then percentage then plus, 293 00:20:16,280 --> 00:20:16,970 then minus. 294 00:20:17,210 --> 00:20:23,360 So everything has got listed and it can be of one to twenty characters such so I mean this one to twenty. 295 00:20:23,360 --> 00:20:25,910 It has been written and then we're having this added up. 296 00:20:25,910 --> 00:20:27,640 Symbols are the symbol is there. 297 00:20:28,160 --> 00:20:35,420 Next we're having this two to twenty lowercase uppercase letters numbers plus dot and our this minus 298 00:20:35,420 --> 00:20:35,600 here. 299 00:20:35,900 --> 00:20:37,820 So now similarly we have written this one. 300 00:20:37,830 --> 00:20:44,180 So here you have this any, any letters and then there is a alphabets and lowercase an uppercase alphabets 301 00:20:44,180 --> 00:20:48,350 and the digits and then dot and, and the minus is there. 302 00:20:48,350 --> 00:20:54,290 So dot and minus and it will be having the list of two to 20 here then will be having one period. 303 00:20:54,300 --> 00:20:55,700 So that is a full stop is there. 304 00:20:55,940 --> 00:21:02,360 And then two to three lowercase an uppercase letters so to a to Z in the uppercase and A to Z in the 305 00:21:02,360 --> 00:21:06,730 lowercase two to three number of and that will be starts in the email list. 306 00:21:07,220 --> 00:21:13,250 So according to this particular constraint, whatever they have mentioned, all of this at the state 307 00:21:13,250 --> 00:21:19,350 of Israel dot com will be a valid email address, but they are not a valid email address because here 308 00:21:19,370 --> 00:21:20,000 is the update. 309 00:21:20,000 --> 00:21:22,880 This added up symbol, there is no character here. 310 00:21:22,880 --> 00:21:27,560 It is not a valid email address because before this added up symbol, there is no character. 311 00:21:27,860 --> 00:21:33,320 And here also it is not a valid email address in the symbols in that after this added up symbol, there 312 00:21:33,320 --> 00:21:34,080 is no character. 313 00:21:34,100 --> 00:21:35,500 We are having directly talked here. 314 00:21:35,900 --> 00:21:37,760 So how many matches we are getting here? 315 00:21:37,760 --> 00:21:39,410 We are getting this matches one. 316 00:21:39,410 --> 00:21:45,020 So that is where Len is actually printing one here and here it is printing their respective valid email 317 00:21:45,020 --> 00:21:47,610 address in this email list. 318 00:21:48,080 --> 00:21:54,350 So in this way, we have discussed that how this regular exhibition can play its powerful role in our 319 00:21:54,350 --> 00:22:00,170 Python programming in most of the projects will be using Python related projects, will be using these 320 00:22:00,170 --> 00:22:06,360 regular expressions and regular expressions that are for different purposes, as I mentioned earlier. 321 00:22:06,620 --> 00:22:10,190 So here is a code I'm just calling up so that you can have a division here. 322 00:22:11,610 --> 00:22:16,290 So a search for a specific string verified the string, whether it is in the proper format or not, 323 00:22:16,560 --> 00:22:23,310 find a string and replace it with another string and format data into the proper form for importing, 324 00:22:23,310 --> 00:22:24,130 for example. 325 00:22:24,390 --> 00:22:28,800 So these are the different uses of this regular expression in our python. 326 00:22:29,640 --> 00:22:30,840 Thanks for watching this video.