The Complete Regular Expressions Course with Exercises | Jazeb Akram | Skillshare

The Complete Regular Expressions Course with Exercises

Jazeb Akram, Data Scientist, Web Consultant

The Complete Regular Expressions Course with Exercises

Jazeb Akram, Data Scientist, Web Consultant

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
49 Lessons (5h 23m)
    • 1. Promo

      2:38
    • 2. Lecture 1 What is Regular Expressions

      7:21
    • 3. Lecture 2 RE Engines

      1:52
    • 4. Lecture 3 RE Offline Engines

      2:07
    • 5. Lecture 4 RE Online Engines

      1:24
    • 6. Lecture 5 Basic Syntax

      5:56
    • 7. Lecture 6 Literal Characters

      2:35
    • 8. Lecture 7 Modes

      4:32
    • 9. Lecture 8 Meta Characters

      2:06
    • 10. Lecture 9 WildCard

      7:56
    • 11. Lecture 10 Character Set

      3:43
    • 12. Lecture 11 Character Ranges

      8:18
    • 13. Lecture 12 Restricting RE

      3:31
    • 14. Lecture 13 Escaping Meta Characters

      5:17
    • 15. Lecture 14 Escaping Sets

      2:39
    • 16. Lecture 15 Ending Chapter

      3:29
    • 17. Lecture 16 Quantifiers and Repetitions

      8:28
    • 18. Lecture 17 Limiting Repetition

      12:15
    • 19. Lecture 18 Greedy Expressions

      8:55
    • 20. Lecture 19 Lazy Expressions

      10:29
    • 21. Lecture 20 Greedy Lazy Testing

      6:07
    • 22. Lecture 21 Groups

      6:03
    • 23. Lecture 22 Alternation

      6:28
    • 24. Lecture 23 Nested Alternation

      5:19
    • 25. Lecture 24 Anchors

      5:49
    • 26. Lecture 25 Another Anchors Example

      3:49
    • 27. Lecture 26 Other Alternative Anchors

      2:15
    • 28. Lecture 27 Word Bounderies

      6:08
    • 29. Lecture 28 Capturing and Backreferences

      7:38
    • 30. Lecture 29 Capturing and Backreferences Examples

      8:54
    • 31. Lecture 30 Application

      16:23
    • 32. Lecture 31 Non Capturing Group

      6:39
    • 33. Lecture 32 Look Around Assertions

      1:39
    • 34. Lecture 33 Positive Look Ahead Assertions

      4:42
    • 35. Lecture 34 Positive Look Ahead Assertions Example

      4:07
    • 36. Lecture 35 Positive Look Ahead Assertions Example

      3:56
    • 37. Lecture 36 Negetive Look Ahead Assertions with Example

      5:12
    • 38. Lecture 37 Look Behind Assertions

      6:22
    • 39. Lecture 38 Unicodes

      5:52
    • 40. Lecture 39 Names

      8:42
    • 41. Lecture 40 Email

      11:29
    • 42. Lecture 41 URLs

      7:08
    • 43. Lecture 42 IP Addresses

      18:29
    • 44. Lecture 43 Dates

      12:28
    • 45. Lecture 44 Times

      11:35
    • 46. Lecture 45 Postal Codes

      11:20
    • 47. Lecture 46 Credit Crads Numbers

      16:38
    • 48. Lecture 47 Passwords

      5:17
    • 49. Goodbye

      0:48
  • --
  • 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.

84

Students

--

Projects

About This Class

In today’s world we have to deal with a lot of data coming from different sources.  

Data from social media , blogs , companies anything you name.   And for a developer its a hell of job for you to work only with relevant data whether you are searching a database, validating user inputs on forms or even in the process of building a website. And this is the place where RE can make your work a lot easy,. 

 Knowing Regex, how to use regular expressions effectively is a valuable skill that can quickly take your skill-set to  top. Logic in programming language requires a long coding work but regular expressions can do the same job within 2 to 3 lines. Regular expressions are such an incredibly convenient tool, available across so many languages that most developers will learn them sooner or later.

RE act like a filter, and they will filter only relevant data which programmer asked for. So, They can save your time, reduce your coding work and increase your productivity.   That's why, RE is a must skill for back-End developers and Data Scientists, 

In this course we will look into RE as a whole because they are supported in every Programming language and Unix based systems.

If you are a complete beginner or want to take your skills at the next level this is the right course for you.  

So, learn RE and tell others that you know how to work with texts easily better  than anyone else with the power of RE. Feel free to preview this course . I will see you inside.

--------------------------------------------------------------------------------------------------------------------

This course is for complete beginners and for those who have some knowledge of Regular Expressions.

-----------------------------------------------------------------------

Meet Your Teacher

Teacher Profile Image

Jazeb Akram

Data Scientist, Web Consultant

Teacher

Jazeb Akram is a Data Scientist and has been working as a Developer consultant. He has been working as a Freelancer since 2011. He designed various applications for many companies and also training individuals on development tools and languages. Jazeb Also has a university degree in computer science from the University of the Punjab, Pakistan, and a master's degree in Data Science from Western Sydney University, Australia.

You can read his full portfolio on his website jazebakram.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. Promo: in today's world, we have to deal with a lot off data coming from different sources. Debt are from Social Media blog's companies, anything you name and for our developer. It's a hell of a job for you to work only with relevant data. Whether you are searching a database validating user in Fort, on farms or even in the process off building a website, and this is the place with regular expression can make your work a lot easy. Actually, regular expression. Act like a filter that you clear, and they will filter only the limit data, which you asked for so they can save your time. Reduce your according work and increase your productivity. So regular expression is a must skill for back and developers and debt are scientists. That's why I created the scores. In this course. We will look into regular expression as a whole because they are sported in every programming language and UNIX based systems. First, we will set up the environment in case if you're a complete beginner, and then we will learn basic regular expressions that will include working with simple text directors and numbers there. After we will start working with some complex topics, like advanced groups, back references, assertions ended. Stipe's and every single letter off this course include exercises so that you can see how different modules off regular expressions are putting life into text and making your job easy and add the end. We will build a project that includes creating regular expression for names validating emails validating the side. Urals matching I P addresses dates time postal courts off different countries matching credit card numbers off major credit card companies, creating strong passwords with regular expressions and many more. So if you're a complete beginner or want toe, take your skill at the next level. This is the right course for you. So learn regular expression and tell others that you know how to work with text better than anyone else. Feel free to explore the scores further. I will see you inside. 2. Lecture 1 What is Regular Expressions: Hello. Welcome to this regular expression scores. My name is jazz Abe Akram and all of your instructor throughout this course. Now, before we start learning about regular expressions, we should know why. It's one of the best approach toe handle text through regular expressions. Actually, digger expressions are the back run off special characters and symbol that we used to match strings, or you can call text in our search. It's also called Reg. Exe and rejects. Be regular expressions allow you to perform complex patron matching on text. A small regular expression can replace the need for a large amount off court. So instead off writing a large amount off court, which could let you mashed deep text, you can simply write one line off regular expression by using symbols and special collectors, which could do the same amount off work as the large amount off court block. Now, let me show you how regular expression actually work by real world example. Now I'm on Google and I typed regular expression as a search string. No, you can see that this is the Wikipedia links, so I'm gonna click on this one now. Here is all the information about regular expression on Wikipedia dot org. But I wasn't intended toe show you this text. What? I was really interested in how regular expression works. So I'm gonna press control plus f toe. Activate the search Dagnall in Chrome browser. Now you can see the field right here in which I can search for any special text. So, for example, first, if I search something like technique go now you can see that we got total to result and one off to reserve is just highlighted right here. If I entered it again now you can see that the next technical is highlighted. And we got only two wizard in case if I saw something different, like computer sciences, you can see that I don't have any expression in this webpage that match with computer sciences. Now, if I remove the s air, the end Now you can see that we found seven matches on this page and one off salmon is highlighted right here. Now, if I enter one more time and turkey now, I'm on my second computer science text. 3rd 4th 5th 67 and all Starting again. So all the search, what I'm doing right now is very comprehensive. This Dagnall is only highlighting those word which could actually meet my requirement and my requirement. WAAS Computer science Just the computer size so you can think this text which I put right here as a regular expression and all other text in which we are searching. You can think off all off this tax as a test string, so regular expression are very powerful and they will only give you those desert exactly what you searched for. Regular expressions are very powerful and they are kind of fun if you understand them. So we're kind of this course. You will be fully ableto work with regular expression, no matter how easy and complex regular expression you want to create. But you have to remember wanting regular expression is not a programming language like C C plus plus pH people or ruby. They are just the symbols, or you can say directors, which we arrange in certain orders that help us to mash detects and they are very useful. For example, you can match any text by using regular expression. I just showed you example on the Wikipedia website, and also you can search for something in a large amount off text file that you have in your computer. You can also find some text and replace it with the new one. You can pick text from one place and move it to another, and you can also the use your regular expression, which you created before the best feature in regular expression is relegation. You can do any type off federation which you want. You can restrict your user toe. Enter those name, which could only have alphabets or spaces, not the numbers. You can also district your user not aware. Negative age and age is equal to zero in forms. When you have to collect some information from the user, you can check whether your user is entering correct Web address. You earl or not by using regular expression. And you can also district the text in the comment section on your reforms so that the user could not enter certain verse while commenting on your post. Furthermore, you can also check better. The email the user has entered is valid or not, so the regular expression for email will look like something like this. I don't have to worry at all because this is just the intra lecture. We will create all the regular expression through our discourse. Enemies. This regular expression for email will let the user with the email. Example. 123 year direct off example dot com. Toby Correct one. This regular expression will also correct email. Example. Underscore Good at the rate off example dot com dot us buddy See Michael Expression will not allow example. 12 300 example dot com herder it us because no email can have to wear their hair sign in email. Whenever I learned a new skill, I concoct elaborate fantasy scenarios where it helped me understand this girl. So here is one for you. Someone killed a girl and these two guys are talking about the murder. One is saying, Oh no, the killer must have followed her own vacation, but to find them would have to search So 200 m B's off email looking for something for mated, like an address. The other one is saying Here's hopeless because finding something in 200 bees off email will be difficult. Now Here someone is coming. Everybody stand back. I know regular expressions. So this guy, you can call him Tarzan or Spiderman is coming towards them. Tapped up some regular expression on the computer, find the merger and flew away. And these two guys still don't know what happens here. So be like a Tarzan. Be like a Spiderman used regular expression toe find text exactly what you want. I'm not a big fan off Spiderman, so you can call him Tarzan. So now you know how important regular expressions are. So we're going to explore it further. So see you in the next lecture. 3. Lecture 2 RE Engines: So now you know how important regular expressions are, so we are good to explore it further. Actually, regular expressions work in different tools. Also called programming language and regular expressions have a tiny bit off different approach while working with these tools according to their specifications. Gold engine. The most popular engines are C C plus plus .net PHP Java JavaScript Fight on my A skill UNIX Tools posits BR e and E R E versions. A party posits br e in e. R E versions and Paul. Honestly, I cannot tell you the difference between these tools as for us regular expression concerned right now because we have not started working with rejects yet. So throughout the scores, I will show you the different approaches off rejects. With these tools, you can write your rejects and put it in these tools like C C plus, plus etcetera and run test mentally. But it's not a good idea because ah, powerful rejects can only be developed with a series off writing and, most importantly, testing. This is where we need a rejects tester, or you can call it engine processor where we can ride and test rejects owner fly without wasting any time. So in the next lecture, we will explore some online and offline engines where you can write your rejects and test them according to your own preference. So first, let's see off line tools. 4. Lecture 3 RE Offline Engines: there are many offline engines for your toe practice. For example, you can download a softer power crap or reject magic from the Internet into your computer and practice regular expressions offline. Also, you can add chrome extensions and five folks extensions that will let you to practice and test rejects offline without any Internet. And also many mobile application gives you the opportunity toe back based projects. In addition to these editors, you can also practice and test your regular expression on some editors, which you use to write court. For example, you can use Norbert Plus plus comodo i D. Sublime text brackets and many more. Well, let me show you some offline engines to practice regular expressions. If you wrote offline Rejects tester on Google, you will find many Rogic's tester to ride and test your regular expressions. For example, you can see that this is the chrome extension, so I'm going to open it. Also, you can see that this is the Firefox extensions for you to practice your logics. You can add it in your chrome. I have already installed it in my chrome, some gonna launch to sap so this tester will look like something like this. This is where you were supposed toe. Add your regular expression and hair. You have to report to your test strings and define patron will be highlighted here. Now this is the chrome extension for practice. Regular expressions. Now for five folks, you can have this regular expression tester. This will be add on Firefox if you want to practice, and also you will find many off rejects. Tester on Google If you want to practice it off line as we are going toe, practice regular expression online. So let's find some online Reg. Exe tester There we can actually died and practice our regular expressions. 5. Lecture 4 RE Online Engines: in this lecture, we will select one online engines took practice regular expressions, so let's move to Google. So here I am on Google and I searched for online rejects Tester. You'll find many only and rejects Chester, where you can write and test your regular expressions. I will show you a couple off ones in this lecture. For example, this 1st 1 rejects when No one dot com. This is very useful. Toured toe right and test your regular expressions. They have many flavors here. You can choose any off the engine in which you want toe practice. You can choose gel, a script or python and go language, but this indexed sport is different in these regular expressions engines. Also, you can find many off the Olin tester. For example, this ridge expel dot com is also one off the very handful tour toe practice. You can find many off on land rejects tester toe. Practice your regular expressions so it's completely up to you. Which Regis Tester you want toe use for writing and testing your regular expression for me and throw the scores will be using this tool rejects 11 dot com. It's a very good ole, and it has many thing to explore. So without wasting any time, let's start writing our regular expression in our next lecture. 6. Lecture 5 Basic Syntax: the basic syntax off your regular expression is quite easy. All you have to do you have to enclose your regular expressions inside Little's such as forward slash so your rejects will be inside to forward slashes. One aired a beginning off your rejects and one at the end off your rejects. For example, if you have some rejects like a B C D E, then you're rejects will look like something like this. Forward slash share the beginning before a then b c D e and then forward slash Add the end off your regular expression. No, let's see this basic syntax in over rejects Tester. So I'm gonna move to our rejects when I want dot com Online tester website So here is our rejects tester, where we're going toe practice our regular expressions if you can notice, Right Erda Beginning inside this fear they have already put this literal forward slash and also they have already put this liquor this forward slash and so on. This tester you don't have to put forward slash I heard the beginning and the end off your regular expression because they have already done the job for you. So all you have to go. You have to put your regular expression right here and then deter string right here. I showed you the regular expression off A, B, C, D and E. So I'm gonna put regular expression off A B, C D e. And this is our regular expression. No, for checking whether this regular expression could find certain reserved and certain match . We have to put some testing. So in this field area, we have to put our testing that we want to check whether it matched with a regular expression or not. So, first, I'm gonna put regular expression testing. Toby A, B C D e seem like this one. No, here is the thing. If you're a regular expression, find some tests. String means if the testing is right according to your regular expression, then this rejects Tesser is going toe highlight. You're testing, for example, a B, C D. Evils, our regular expression and our testing waas a B C D e e as well. That's why I detest ring has been highlighted. Now, if I remove this e air the end in the festering field, then you will notice that the whole pestering won't be highlighted anymore. So let's remove this E. Now you can see that we don't find any match. So this regular expression is not well it for this test ring off a B C D. If I add E again now you can see that we found one match. That's why this one is highlighted. Now, if I add something different hair a B C D e I, then you can see that a B C D E is still highlighted. But eyes not highlighted, although this hole is our test ring. So this whole testing a B c D e has been fair. Why? Because our regular expression does not meet with this test ring off a B c d e i. It's highlighted the 1st 5 directors five f Robert, but nor the last one That was I. That's why distress string the whole one a b c d e. I has been fared No. If I had moved the struggle, expression and air something like a B, C D e. And I know you can see that detest ring is completely valid because the regular expression completely holds this test ring. You can change it. For example, if I ard regular expression here, Josip, and give it festering off. Same charges They can see their jobs. It is highlighted. If I remove this e from here, it's not hiring anymore. And if I adhere? A you can still see. We have not found any match here. Also, you can notice this pope up right here. No match has been found. Four steps mean that this richest 11 dot com processor is doing some algorithm on this one . We don't have to notice the hair and it is Our testing has been fared so this regular expression does not find any reserve. Also, you can have some regular expression like zero double 569 and the pestering You can give it something like zero double 569 We found a match for the whole district has been highlighted . If I ard one more digit hair like it, you can see that 80 is not highlighted. It means that this testing off the irritable 5698 has been fairly now before ending this lecture, remember at the beginning, I told you, you have to put forward slash Add the beginning and the ending now one more thing to say here you cannot use forward slash inside your regular expression for no, I will show you how you can do that if you have to use the flower slash inside your regular special later. But for now, just remember that don't use forward slash inside your regular expression. 7. Lecture 6 Literal Characters: this whole chapter will focus on characters. So the first lecture villa about literal collectors in regular expression literal, correct ear's is all about text. For example, if you have rejects O H N inside your forward slashes than this edge end will only match with O Etch and highlighted in green, it will not match with John. And also it will not match with mourn because John has j heard a beginning. Neglecting this rejects and also mourn has m air the beginning also falsifying our rager. And also, if you have some rejects like color c o l o r. Then this rejects will only match with festering off color exactly C o L o r. Highlighted in green color. It will not match with c o L or you are. Also both spellings are true. But remember, I told you that Rogic's is not a language. Also, it's not a programming language. It's just the representation off symbols and its arrangements to track text. That's why it will only match color c o l o r. But not c o l o U R. Now let's just this literal collectors in our rejects 11 dot com So our first regular expression Waas who etch en and inter testing. If I give it or etch end, we phoned the match. If I give it g o h n, you can see that wet and is still highlighted, but nor the whole testing. That's why this match has also failed our regular expression off watching No If I adhere M o h in now you can see that distress string is also fair If I argue expression off color hair and for testing If I give it c o l or you are now, you can see that the testing has been fair on this regular expression because this one is not matching with our regular expression. If I remove this you we found the match so literal is all about using directors in regular expressions. 8. Lecture 7 Modes: No, here is something more to come in magics, syntax And that is more We put more air the ending off over forward slash. For example, if you have a regular expression off rejects, then you're more will be aired The ending off your forward slash right at the end we have many more. For example, we have standard moored image. We don't write anything at all. After the ending forward slash This is gore our standard moored. Then we have global more in which we put G Erda and off our regular expression. Then we have single line more in which we put s Then we have case insensitive moored in which report I then we have multi line moored in which we put em and many more. Now I cannot tell you the difference off all of these moors right now at this moment because we will use them throughout the scores. For now, I'm just going to show you global moored and gays in sensitive more so global more is denoted by G and case insensitive, more denoted by I know. Let's test these moors in our rejects Injun tester. So here is our tester No, on this website. You can see that regard this flag right here. So if I click on this flag, you can see we got a couple off Moore's right here. Regard global more so effectively contest global one. Now you can see that this website has already put G by itself. When I click this global more If I click on some other more like Martin and more and unclipped this global moored you can see that we got em. And ah, if I also collect the global more than you will see both MNT So for now First, let me show you the global more. For example, if I have a regular expression off color and for the test ring I have something like color And then I wrote some field festering like jazz ib It doesn't match our regular expression de night. I'd color again Dinner tired color again denied right color again So what we're doing right here By using the couple more, we are checking the whole test strings globally. We are finding our match and we're returning the reserve and highlighting them in global more more than one. Now if I turned off this global moored by unchecked this global more. If I click it again now you can see our G has been vanished and we only returning one match color. Also, These one are also completely valid according to our regular expression. But we don't have global more. That's why we're not checking the whole test string globally. Let me on this global more again. Now you can see regard Total four matches. Now let me show you the case insensitive more and that is I will find it right here. So I'm gonna click on this insensitive moored. Now, if I write her color with a capital O, you can still see that we guard four matches now if I ah, color in capital letters, you can see we still found the match off color. Now, if I remove this I this case insensitivity from here. If I remove this one, you can see that this one is not matching at all. Instead, if I right here, CEO l and then or in the capital form, then are we got only one match. So in case if you want to allow some upper case and lower case letters in your test strings , Toby matched with your regular expression. You should own what? Yes, you should, on case insensitive more. It will let you also find upper and lower case letters in your chest straight to summarize . You put your moored that I'd edda and off your forward slash 9. Lecture 8 Meta Characters: matter. Characters is all about operators. They have special meaning in regular expressions. Unlike the mathematical operations that we used in our daily life, they have the same symbol. But the working is different, so all of the operator, which you are seeing right now, have completely different meaning in regular expression. As compared to mathematical operations, you cannot add two things. You cannot divide two things. You cannot multiply one thing to another in regular expressions, because these symbols, these meta collectors that you're seeing right now on the screen have completely different meaning in regular expressions. As I told you earlier at the beginning off this course, regular expression is not a language. It's just the representation off symbols, which you could arrange in certain orders to match your text. In chart is three short test form to represent text that will only understand by rejects engines. So all of these operators have completely different meaning in regular expressions to these meta characters, just symbols. Now let me show you in rejects mano one dot com, for example, if I add when regular expression off six plus three hair now you know that six plus three is nine so if I had nine here, you can see we don't have any match because we cannot add two things, although it's completely relative in mathematics, but not in regular expression. Now, for example, if I multiply three with two and put something in testing like six now, you can notice that we still don't have any match. So for now, just remember that these matter collectors have completely different meaning in regular expressions. Pro discourse. We will explore their actual meaning in regular expressions. 10. Lecture 9 WildCard: In this lecture, we will learn about wild card meta characters. Wild card means any characters except new line it represent by dot For example, if you have a regular expression off Oh Etch And in which you want to add any corrector air the beginning off question, then you will have to simply put dot at the beginning. So this regular expression off daughter or etch and will match John and also this one will match mourn. So first time we took J from Dart. Then in second time we took em from Dart means from wildcard. Similarly, if you have a regular expression off vile guard duty dot beauty then you can make this regular expression toe run for detest ring off cut and port because you can put anything at the dark place for one time. If you use this world card off dot Now let's try this one out. So first I'm gonna put right here or at end and in the festering I'm gonna put John and Mon and 40 more. I have selected as we will see this as more in this lecture. But first, let's click this global more right now. So we got only Jim owed Global war writer. And now, in case if I put dot air that beginning now you can see that we found too much in case I put something like J j o h n. You can still notice that we don't have any match. So this jg Weston because dot only allow one corrector toe get adjusted not more than one corrector. Now, remember that I told you that vile card could be any corrector except new line. So, in case if you want to use this wild card for new line as well, then you can done on your single line more. For example, if I remove these testing from here and and make this regular expression Toby Josip dot a gram and for the testing. If I put same here, Josip, and then put a line return. And on the next line, if I add a crime right here and in case if I want to use this door as a new line, then I just have to turn on single line moored. That is s No, you can see that we also use this dog this wild card for the new line. But remember that. So you have to be careful about that. So this dot is highlighting the new line just because off this s moored. Now, if I turn off the single line more now, you can notice that we don't find any match. No. One more thing to do here. Some people have names like dr dot John and dr dot Account. Then what is going to happen? For example, if I adhere, dr dot Josip Jay's capital right here. So I'm gonna turn on insensitive moored here as well. Now, if I adhere seem string Toby you doctor dart then speaks then jazz ib You can see that we found a match, but instead off dr dot If I are doctor d, you can still see we found a match Although the testing has completely failed on this regular expression off Dr Dhar, just a back room. It's just because if you air the dart then by default regular expression engine will think off this door as a wild card, not as a single straight dot That's why you can put anything right here. You can put Z as well Dr Z nor dr dot Josip. So in case If you want to use dart just as the straight door without making it wild card, then you have tow escape this door. So for escaping this door, do you have to put a backslash before the start? Now you can see that festering off doctors the does It has been fair. Now if it moves that still we don't have any match. Now if I add dot here we found a match. So escape dot When you don't want to use your dart as a vile guard No One more thing to clarify here. If I remove this space from here, you can see that we don't have any match because really move these base. So remember, one more thing. Base is also a director in regular expression. Now, if I are very simple regular expression here Toby poured toe china And in the festering I add export. So china as well You can see we found a match. Now if I remove this space from here, you can see that we don't have any match now If I remove the space anywhere from the regular expression, we don't have any match anymore. Now One more thing to show her. If I add one space that I'd add the end off our regular expression like this. Now you can see that we don't have any match until we also add space Erda and off over testing. So remember that if you want to use vile guard just as the simple one straight one, then don't add dot as environ card always escaped like this with backslash air. The beginning off your dot You can also put numbers as environ card as well. For example, if I have value off 3.14 No, this daughter is serving as a wild card so I can put anything right here. I can put 3414 also match. I can put 3514 I can put 3-14 also found a match. I can put anything here. Now you can notice that 3.1 40 value off pyre. So, in case if you want to make it just the value of fire, then simply just escape this one by putting back slash Now we don't have en match right now . So know this one could easily match with 3.14 Similarly, if you have some final aim off student underscore record Start txt and you want toe Find any five this name than in the testing. I put the same one. But also if I remove this daughter and for something like be we still found a match In case if you want toe make this not wild card Just put back slash Right here. And in case you're not sure whether this fire is students dash or students underscore record, you can simply put dot here as well. So this one would match both students dash record and students underscore like a dot txt file. 11. Lecture 10 Character Set: continuing director chapter in this lecture, we are going to learn about cracked assert that is represent by brackets. Know what is practice it. We use corrector settled, define assert with certain directors and regular expression In general, pick any character from that set. For example, if I have a regular expression something like this in which I put CD in tow records So our character set is CD here. Then I have e s Etch right after my director said so this regular expression will match cash and also match dash Why? Because first time when we applied for cash it's going toe pick See from character set off CD so it will make cash. Then if I add some stestanovich Toby Dash than is going toe pick d from the character start and he s set from the just off the regular expression. Similarly, if I have some regular expression off VR in character certain than a than nd in character said then I asset, then our regular expression will pick V or are from First director assert or an hors d from second character set. For example, our testing off vanish will pick V from the first corrector set. Then it will be from the regular expression then n highlighted inboard from second director set off nd then I s h completing over testing off vanish. Similarly, the second test ring off reddish are will be picked from the character set off the 1st 1 We are then a then second characters that will give it d Then I as at 40 dust off the regular expression match. Let's run it in our regular expression tester So firsthand I'm going to define character set in which I'm going to put cool things C and D Now, for the next one, I'm gonna port here E s etch Now this is a regular expression C D is in the character set now for the testing. I'm gonna adhere Cash. We found a match. I'm gonna put Dash here. We still found them at If I put something here Dash, you can see that we don't found any match for this cash because he is not Indyk electricity . Similarly, if I add specters that hair Toby, we are indeed character set than a than nd in second corrector certain then I s at 40 simple collectors. Now, if I run this resting Toby vanish. We found the match. If I adhere Reddish, we still found the match. See, I did capital R and I turned on I case insensitive more right here. If I are something here, Toby Zen ish, we don't have any match. If I add something here, Dan ish, we still don't have any match. So character said give you the opportunity toe pick characters from the set off directors that you define. 12. Lecture 11 Character Ranges: here is one easy task for you. I want to create a regular expression that will match strings like 18 B team C, team up toes eating. You have one minute to figure out what regular expression is gonna work on these desk strings. All done. I know you learned about, Director said in the last movie. So you will come up with some regular expression like this emits you will put a B c d e f g h i j k l m N o p Q r S T u V W x Y z In character certain, Don't you have space Dan team? Although this regular expression is completely relative. Ah, Kordic door test case. But this is not the good idea to put all off these alphabets in character set just to match one. Let me tell you, this sophisticated very toe. Create a regular expression that will match these guesses off 18 BT men so on, and we can do that by using corrected ranges. Corrector ranges represent by dash. So all you have to go you have to define a range between two well for birds that will take care off all the middle ones. For example, if you want to create a regular expression off characters A to Z, Daniel rejects will look like something like this. So this range air to Z will match all the alphabets from A to Z in lower case. Now, if you want to create arranges for the upper alphabets you have to make the range is denoted by capital a capital Z, and you have to put dash inside them. So this rejects will match all the alphabets from Capitol Air Toe Capital Z. Now, if you're not sure whether you have to add lower ranges or up arranges, you can mix them up like this. So first you have to our drains off a dash Z means a to Z all the lower ones. Then you have to add capital. Ada Z Capital Z means all the upper months, and this regular expression will take care off all the alphabets in lower form. Also in a perform no one important thing to notice here. I didn't put dash between Lower Z and capital a VAY because there is no range between lures . You took capital. There are only two inches from lower heir to Lord Z and Capital Air Toe Capital Z. There's wide and put any kind off dash between Lord Z and Capital now. Similarly, like these characters, you can also define the range for your digits. You can define a range from 0 to 9 that will take care off all the digits. Now for the digest. One most important things to remember her. You can only define a range from 0 to 9. You cannot add any range from 55 to 60 or 72 80 because regular expression is not like some other programming formula or algorithm. The rejects in general only think and understand range from zero tonight. Let's to done this in our tester. So first of all, I'm gonna put the hair of on old regular expression that I showed you a B c d e f upto z and I put it in character set. Then I have one space, then team, so this one will match a team. This one will also match B team This one. It will also match Z team, but this one won't match. Two characters air the beginning like a C dash team. There's why you won't see the whole string off a toe EMP highlighted. I only see two m is highlighted Not the same thing. I can go by using corrected ranges. I'm going to remove all the letters from here and I'm gonna defined range from a to Z. Now you can see that same thing right here. Nothing changed at all. So used corrector ranges. When you have to define director set, you can also define range for upper ones somewhere defined range for upper months. Capital A capital Z ing. We don't have any match, so I'm gonna add hair capital, a dash team. Now you can notice that this one is only valid for disagree. Expression off. It was in a point because I don't have I'm or right down. That's why I'm not getting the match. On these three months. I can also add match off. B team here found a match. No, I can also mix up capital air to Z and lower A to Z like this. So first I'm gonna add capital A to Z. Then I'm gonna add lower a to lower Z. So this one will match all these one as well, but not distance elects removed this one from here. And also you can put lower or upper at any place in characters. 30 want. It's not gonna make any difference at all, but same thing here. I cannot add two letters. Air the beginning like if I adhere Lower A and Capital B, then theme, then I don't have any match toe this festering off a capital B dash team. Why? Because I can only pick one character from this character set in the records that you can see. You can also pick director from certain ranges. For example. I can pick character from a toe. See, now you can notice that only 1st 1 is highlighted. I can pick character from a tow Jew. Now you can see that he's highlighted. I can pick any character from any director. For example, I can pick Director from sea to you. Now you can see that only tease highlighted because we don't have any corrected that lies in this stage. Let's try the digits one here, so I'm gonna define rain off zero toe nine. I'm gonna remove all these from here, And also let's to move this one as well. Now I can add zero this one match one to up to nine. If I adhere 10 we are still getting the match. But one thing to notice. Here we're getting the match individually. That's why you can see tiny bit off space between these two digits one and zero. Now, I can also define it from 7 to 9. I can also define it from 0 to 3. Now, if I try to define it from 55 toe 45 now you can see that we got patron better because I told you that we can only define digits one within 0 to 9 limit. We cannot define the character ranges other than 0 to 9. Now. Any case, if you want or define a custom ranges. You can do that by doing something but different. For example, I want to create ranges from 50 to 55. Then I can simply put five at the beginning, then 0 to 9 or 0 to 5 inside the collectors surgery inches, so this one will match 15 54 55 but not with 56 or 49. So did you know you worked with ranges 13. Lecture 12 Restricting RE: you can use getter symbol to restrict your regular expressions. For example, if you have a regular expression off A B, c D E f in character set, and you want to use all the possible matches except a B C D E F. Then you can simply put gather symbol. Or you can call north symbol inside your character set. So this one will match every character except a B C D E f. Now. Similarly, if you have some regular expression CD in character, said in a research, So this one will match anything other than cash and Dutch. Also, if you have some regular expression off VR in the character set, but with the carry symbol with the North Air the beginning, then this one will match any director except vanish or radish. Let's try this one out. So first I'm gonna add hair collector set off a B C d e. Let's suppose the testing here A B, C, D. E. T. Phoned the match life I had here, not symbol. You can see that we don't have any match anymore. No, if I are something different hair Toby that Steve I I we found a match and it's Nord even match. This is five match because we are using characters that not the dangers. If I adhere a we don't highlight it If I r d we highlighted J if I r e we don't highlighted e So by using this not means this scatter symbol you can exclude all off these characters from test drinks. So if I are something here to B c. D and ad Yes, that's after that. If I give it testing Toby Cash I don't have any match If I adhere Fash we found them at if I had her dash. We don't have any match If I remove this gather symbol See now we found a match for gas and dash So putting this gather similar gonna make your anger expression toe work as not similarly I can make it for banish as well. So I'm gonna add VR here and then e then nd in the next character set than I are such So this one will match anything other than vanish or reddish so it can match nor d vanish Won't match with reddish but it will match with Spanish so I can pick any character from this one. But I cannot pick V and our except for V in our I can pick anything. I can pick Zed from the first director, sir, than a then the then I s h no. This scatter symbol this not is only valid inside your character, Assert if you want to use this character set toe work as not you can simply put the scatter symbol. So this is how you use gather symbol to restrict your text inside electricity. 14. Lecture 13 Escaping Meta Characters: remember in the first lectures, I told you that you cannot add farmer slash in your regular expression until you do one exception. For example, if I have some regular expression Toby Josip, forward slash a crumb regard the patron letter. So if I add jobs, it forward slash a gram festering here. We cannot execute this test because our regular expression is not relative. So using forward slash is quite easy in your regular expression, all you have to do you have tow escape your forward sludge and you can escape your flower slash by adding back slash before it like this. So now we found a match and we don't have any er similarly, what we did with divided card dot I told you that if you want to use your wild card as a straight one, then you can just simply escape this one. I escaped this world card and all. I can only use this door as a simple street dot I cannot add anything like wrt from this wild card because this is nor the wild card anymore. If I remove this backspace now, you can add anything here why or B But we saw it in previous movies, so I'm not gonna revise it again. So let's leave this as it is now. 44 slash You also have to escape your forward slash as well by adding back slash before it . Now, what if I have, ah directly to match my other good expression. For example, I have a directory off this sea user Fuller than jazzy folder than documents Fuller. Then I have some file off student dot txt and I want to create a regular expression that will be okay for our engine. I can make this regular expression right by escaping couple off things here, for example. First off, all I have to escape this backslash that I wrote right before you. So I'm gonna add one more time back slash share now, before making it right. Let's all supported in the festering so that we don't have to change it again. So I put back slash right here then before jazz. If I got this backslash again. So if you want to use this backslash as this simple backslash because this back slashes the matter character, it has a different meaning in regular expression. So if you want to use this. Backslash it a straight one. You have to back slash it escape it again than this black slash as well. This backslash as well. Now we found a match this txt So we also have toe escape this one as well. So this one will match any file order directing that could have see Dr Than users and jazz Abe documents and accept a etcetera. Now this is also the matter characters This column right here. So it's a good idea if you escape it also now something more to come in this lecture, for example, in Dr String if I enter one tab right here and I want to match this tab there just I enter I can match this time by adding back slash t So this Steve ill matched back slashed evil match the tab that I just enter If I add tab one more time by pressing the turkey from my keyboard No, I have to wear it one more time. Be now If I lined return, it means press shift and enter toe Make it next line. No, this one don't match anymore with this line return for example. If I adhere a gram. No, If you want to match your line, Britain's you can add slash and and then a crumb. No, we found a match. So in some regular expression, we have slash and in some we have slash are in some way use slash ener slash are to use line returns in our regular expression. Now, after a crumb, if I add again one more line return by pressing shift, enter from a keyboard and add Josip know our regular expression has not completed. So first I have to air slash and for completing the line. Didn that I added after a crime in testing, Then I have toe air, the jazz it see. So in short, if you have to use your line returns, you can use slash and And if you want to use tabs key from your keyboard than you can use, back slash T 15. Lecture 14 Escaping Sets: in the last lecture, I assure you how you can escape meta characters in your regular expression. But what about correct? Assert, because you can also put them in character. Set, right? But what about them? Do you really have to escape all dramatic electors inside? Your director said. Well, the picture is different in character Set. As for as meta characters concerned, you only have toe escape certain meta characters inside, Director said. There are only four meta characters that you need to escape inside your character certain, and that our dash forward slash multiply sign and then ending Breck it. These four meta characters need Toby scathed inside your character search. For example, if I add characters act hair, Toby, dash forward, slash multiply and ending bracket, I cannot air de testing that could match with these characters set items I can enter here anything, but it's not going to make any difference until I gave them. For example, if I gave this dash, all I have to do I have to wear the backslash before it. I have to wear backslash before the forward slash backslash before multiply backslash before the ending off over bracket because it is clear that we added all the backslash is for these characters. Dash forward slash in multi member Why the name on Earth? I added the backslash for this ending bracket. This one right here. It's because the regular expression Injun is going to confuse whether this character set bracket is ending right hair or here. There's why you have to escape this one now The escaping off these motor characters is different in different engines, but as a whole, only these meta characters ending off bracket multiply forward, slash and dash need to be escaped inside your character certain, so make sure to escape them if you want to use them in your festering, so let's to run them now I can match, multiply, can match dash I can match forward slash. I can match what left ending bracket as well 16. Lecture 15 Ending Chapter: Now, before ending this chapter off characters, I want to show you one easy way to write search. You can use back slash W two dried character set off a to Z lower capital A to Z 0 to 9 and underscore so back slash the blues seem as word characters and underscore. You can also add back slash w that will be seen as scattered means neglecting a to Z capital A to Z and 0 to 9 ridges and underscore. So it means that there will be no word characters if you use back slash w and there will be no underscores No, you can use back slash s to match the tab and also divide space. You can use backslash capital s toe neglect space and also neglect up. You can add back slash d and that will be seen as ranges from 0 to 9 digits only. And if you want to neglect 0 to 9, you can add back slash d and put the gather symbol at the beginning off your character side inside characters air. So this one will match nor digit at all. No one more very to neglecting digit. And that is adding backslash capitally So back slash capital, the means nor digit at all. No, let's tried these one out. So first off, all back slash w that will match. Hey, also mass capital t also match zero also match underscore Dash It will not match stash. It will only match. It was E capital A to Capital Z 0 to 9 and underscore if I change is w Toby Capital one. This one will not match any off the tax drink from a to Z toe capital A to Z toe 0 to 9 or under school Now if I adhere small s so the smallest will match space and tap. So if I enter tab Key we found a match. If I enter here speaks We found a match as well. If I had capitalists with going to neglect tab and space seeing we don't have any match at all. If I add back slash d so it will match 0129 If I add capital D So this one won't going toe match with 0 to 9 now If reported inside Character said so it will be same. It means that no digital Similarly, I can make this Toby Smalley sort small. It is going to match all these one. Now, if you add scattered symbol at the beginning So it gonna neglect all these testing off zero toe night. So remember that lower ones are for allowing something, and capital mons are for neglect getting something. These regular expression notations like W s nd are supported in all rejects engines, except for some UNIX tools. 17. Lecture 16 Quantifiers and Repetitions: we are starting new chapter off repetitions. No. So, first we will discuss 20 fired repetitions in regular expressions. No. First, we need to understand what is going to fire. 20 fires are wild card that specify how many times to match the preceding string. Packer der notation in meta characters is something like this. If you want to match zero or more off previous, then you can use special symbol off static so static will match zero or more than one off previous collectors. Then we have, plus meta character that we used to match one or more off previous corrector than we have question mark that we usedto match one or zero off previous. Now they are supported in all regular expression engines except for some or UNIX tools like br eas. Now let's see couple off example off them. So first I'm gonna show you example off using metta corrector off question mark as a representative quantify. So I have this regular expression off flavor in which I put F l a V or you. Then after u i port 20 fire off question mark than are so this question mark means you is optional here. I can take zero means I can make this you to be optional, or I can take you as one time. For example, this regular expression will work for the test string off flavor and also flavor without you. So, in short, adding question mark means making something Toby optional. You can add one thing optional according to your own choice. Similarly, if I have a regular expression off encyclopedia and I put a question mark right after B A means died after it. So this is optional right here. This regular expression will accept pestering off encyclopedia with a an encyclopedia without a. Now, let's run these two regular expression in our Injun or so First, I'm gonna adhere Flavor. And I'm gonna make this you Toby optional. So this one will match flavor video, and also this one will match flavor without you. So adding question mark means making something optional. So I made this You Toby optional. No, let's run other example here. So I'm gonna add here Encyclopedia. Now, I'm gonna make this air Toby optional here because both dispelling our equity it according to English. So I'm gonna add here encyclopedia with a and now I'm gonna add encyclopedia without it. We phone a match as well. So this question mark means making something previous. One means this a Toby optional. No, Let's see the example off static. As I told you before, you can use static toe. Make the proceeding one to use zero or more time. For example, if you have a regular expression off Buz than static. So this regular expression off buzz is going to be done for the testing off. Bu just be you without the because you can take zero or more time. Then you can also make this one to be Buz with simple. Once the then be you double the BUE cripple ZN saw so in charge Ecstatic means using previous 10 or more time no running it right hair. So I'm gonna add Buz than static. So this one will match for Buz Also mad bu double Z bu as many cities as I want. This one will also match will just be you buy because you can take that Toby zero And you can also make Toby more than zeros. This one will also make it bu triple Z. No, the last one and that is using meta character off plus 25. So the plus means depleting proceeding. I turned to be one or more time. So in case if I have a regular expression off +029 range +029 range 0 to 9 reagent 0 to 9 in. And if I add plus right at the end. So this one is going toe Fuck four detest ring off 0123 So this zero is going to be from the first character set trained one from the second character set range to from the third characters that range and then three from the director said created This one will also match 6565 This one will also match 5685 And for the lost when we can take as many as we want, this one will match 454545 So this one will match all these one but not highlighted in direct this one more time At 012 also just toe and also ate six elected on this so that you can see the difference. So first of all, I'm gonna adhere simple 0 to 9 and adding the plus at the end. No further testing. I can add one hair we found them at. I can add more than one. I can add any characters I want. We found the marriage because plus means taking one or more time. So now if I adhere one more time 0 to 9, you can see that. No. First we're goingto take one character from here from the first ring. Then we're going toe. Take one character from this repetitively range This range here. So this one is belong toe this 1st 1 and for the next one, we don't have anything. That's why this one is not highlighted. In case if I adhere more than one. And if I increase the director start Toby 0 to 9. No, this one is also feel because we have at least three characters Toby selected. If I adhere three length range 456 we formed. Imagine if I increase the character set ranges one more time. 0 to 9. Now you can see that this one is also not matching. In short, plus means you can use one or more time from your character set or from single digit. For example, If I just have one here then This one is going to be used as many times as I want. I can use it for one time. I can use it for many times. I can use it any more time. I want NY fired here too. We fared the match. If I had hair oneto, we still fear that much. If I adhere zero we fear them at so one plus means you can repeat 11 time or many time now all these quantify IRS are very useful and we use them all the time because we don't want to waste over time because we can easily repeat things out by using these simple meta characters. 18. Lecture 17 Limiting Repetition: we don't have a control on these meta characters. We cannot make this static plus and question mark other than their actual meaning. So what if I want to repeat one character four times and I want to repeat certain character three Time What? I want to repeat certain character at least two times, or I want to repeat certain character from 5 to 6 times. Well, you can do that by using other symbols, and that is by using the curly braces inmates. You put certain number off your choice off repetition, and there's notation will look like something like this number inside caliber asses. Now for the first scenario, for example, if you want to match exactly number off previous like I want to repeat four time off previous, I can put four inside curly braces. Similarly, a can Port nine into calibrates is repeated. Nine times I can put five into Calibrates is to repeat previous oneto. Five times I can put you into calibrates is to repeat it toe to times. Similarly, you can define our range from minimum to maximum, so in the first portion you have to put your minimum number and in the 2nd 1 you have toe put your maximum number and separate them by using coma. So if I have warned, would appear something from 4 to 7 times, then it will look like in calibrates is for comma seven. So if I want to appear something 3 to 5 time, it will be three comma five now what if you want to define the least range but north the maximum rate. You can do that by using last line. For example, I want toe repeat something minimum three times. But for the maximum, I'm gonna leave it for the user. I can repeat it maximum five times nine times, but the ground minimum value will be three. So instant tax will be three coma. Nothing indica Libous is now let's try some examples out. For example, if you have a regular expression off 0 to 93 and we have a range from zero tonight, so it means that we can take exactly three numbers. So this one will match test string off triple 07 to 3. But it won't match 45 because for five have two length width and we cannot add 4545 because It has four length, so three means only you can use three numbers from this range. Exactly. T number? No. In case if you have a regular expression off 0 to 9 and three coma, it means that you can add minimum three numbers from the range of 0 to 9, and you can add as many as that are. You want more than three, so I can adhere. Testing off three length highlighted in green. 0007 to 3. But I cannot add less than three ducks by 45 is in red color. I can add 4545 fort length. I can add salmon linked eight length number now if you want to be certain, for example, if you want to define our range value from 3 to 5, so the minimum number that you can air from this range will be three. It cannot add two numbers. There's where 45 is in red, and you won't go outside off your maximum limit. Your maximum limit is fly right here, so you cannot add six digit from the strange off the road line. That's why 454545 is in red it not going toe book. So this simple phone number that you can get yate by using the knowledge which you guard so far will be very simple. So your regular expression for the simple phone number will be 0 to 93 d years. Dan Dash, then 0 to 93 did years only three digit darn dash and then 0294 digits and exactly four digits. So you're total phone number. Digits will be 10 so this regular expression will match this number Triple 0-454 That's 7845 This one will match triple 64788 Double four six dash in between. But this one won't match with Triple zero. Four five four Dash 4578 To Why? Because we are adding the five length air Diane, and we cannot are there because we can only add four length are done. Let's run these regular expression all So. First, let's define correct a range from 0 to 9 and I want to use exactly t did years, so this one will match triple zero. This one will match 458 This won't match with one with 12 with 89 below tree. It's not going to match. And for the maximum, this one will only match with three did years only know if you can add coma right here then this one is going to match all the digits that have at least length off. Three and more than you can define any length I can define and elect I want because the lower one history Now, if you want to define the in from 3 to 5 than this one is going to match Onley 3 to 5, for example like I can adhere. 7896 and three. I don't know if I add one more letter like seven. We don't have any match toe this if I add one more thing here, Toby, this one, we don't have any match anymore. This whole one is highlighted because we only global more and that this 45 is satisfying this three condition. And if you can notice that they have put this tiny bit off space between this right here as a whole, this match has also fared No, let's try the numbers that we just saw so defining range off 0 to 9, and I want to use only exactly three characters than Dash, then repeating it against I'm going to copy it and paste it again. Then Dash. Then I'm gonna baste it one more time. But this time gonna make the range two B four letters. So this one will match this number. This one will match this number. But this one won't match with this number because one length is right here. And we added a three length. And also this one won't match with this number because we have the wrong length here and here. There should be three length here, and there should be four length writer. No, here is one simple toss for you. For example, if I have some strings like Johnson Dash Assess and then dash than 90 years than deal be, then dashed in 1994. And we have many numbers, many testing like this. And I want you to create regular expression for this. Then your regular expression will be something like this. First, I'm using the other notation off w. Then I made it Toby Plus so that it could take one character, at least one character and more than one is low. Then dash than SS end and dash digits will be nine. Then dash, do you be dash digits, Toby? For so this one will match Johnson Dash SSN do you'll be 1994. This one will match Peter and so on. But this one won't match with 64 airtime because we made digits loss Toby 41 And this 11 match with this Essen. And because it has more length than the SS and length, let's try this one out. So I added it pestering right here. So first, I'm gonna g eight regular expression that will only match with these two testing. So first off, all I'm gonna add the w boundary. So we added W bone. You know, I'm gonna add the plus symbol. So the plus means that we have at least one character and more Denman is alone. Then I have dash. Then I have S s n we're still following everything. Then we have dash than 40 numbers. I'm gonna add her other nation off B and ah, I'm gonna make this due to be taken only nine SSN numbers. Then I'm gonna add dash to match this dash. Then I'm gonna add to your be for matching this deal B. We'll still you can see that this one is falsified. But this expression is also valid. No, After that, if I r Dash, we still found three matches. Now you can see that this one is right here. This one first in we got named and dash than SS and mean Social security number there Dash then SS and only contain Americanness is and contain nine digits. That's why I did nine here. Donaire did dash them deal be, then dash again. Then I got something like you're in four digits. So let's add back slash D and making it toe only four digits. I can see that this one has fully year 1964. Also, this one has fully you're 19 94 But this one has only two digits off year. That's why this one is fair and this one is fair. Do your duty Many numbers off SNN and we made it to use only nine digits now, similarly like this, you can also define the limits to your characters. Eight was the year capital A to Z. So this a to Z is going to take at least three character from the end of here to Z and many Director, You want doodle coma So this one will match Tripoli. This one match five times in this one will match w I I and so on. But it won't match b and double it because he got one length and double the guard Poland, Let's run this out. So let's remove all this from here and I'm gonna add hair. Toby, it was e making it character set ranges and making it all t and coma. So this one will match. Is anything more than three? Exactly. 31 No match to length, no match. So these reparative quantify IRS are very useful because you can limit the content by using calibrates is 19. Lecture 18 Greedy Expressions: 20 fires are very simple, but in fact they can be tricky, sometimes by before the regular expression tries to match. The quantity fires as many time as possible. Because the regular expansion engines are greedy, for instance, deep lust will consume all possible digits. And when it becomes impossible to consume, or then it continues to mask the dressed off the patron, if there is no match than it, decreases the number off repetitions and tries again. And that's do toe the greediness off regular expressions. Let me explain this what I just said to find a match, the regular expression engines using the falling algorithm using greedy approach. And that is for every position in the string. Mash the patron at that position, and then, if there is no match, go to the next position. For example, if we have a step, string off art has mountains and many seas to explore. No, let's see the regular expression in this regular expression. First we have quotation, and then we have dot means vile card. We can take anything from this wild card, and right after this world card we got plus quantified means we can repeat this wild guard one or more time. Then we have quotation at the end off this regular expression. Now we need to understand how the regular expression is going to return us the desert by using the greedy approach. So here is our regular expression quotation than wildcard repeating yourself. Then quotation again and hair is our string that we want toe check on this regular expression. Now, for the first part, the regular expression parter measure will focus on the quotation because we grow our D quotation at the beginning off our regular expression. So it will come into our area off testing and see at the first position if it confined the quotation there. So first it will come to our string and our string is starting from the earth, starting from the letter e so it won't find decoration there, so it will look toe a whether a matches the quotation or not. Then it will look two words the second toe, third toe our position, then t then edge. Then it will look for the space. We don't have the quotation yet, so it will move forward letter by letter until it reached the quotation. And that is before the mountains. So it will say yes. I found this starting off my regular expression here. Then it will focus on the viol car dot and dot can easily match our M. Then it will match em the after dark after our world God, we are repeating it by quantify So we can repeat divide guard as many as time possible so that it will repeat the vile guard and match Oh than you then n then t than aid And I'd an end then s so it will match mountains Now the next thing is the quotation as we are using the greedy approach here. So our in general match this quotation from the viol guard repetition because we still have many thing after this quotation. So it will match this quotation from the vile card and then look for the space than it will match this pace also from the wild card. Then it will move forward and match a and D and then moving forward. Then it will match many. Then it will move forward Matt quotation from the Royal Guard than it will match sees from the wild card. Also the ending that we got right after the text sees it will match it from the vile car. Then it will move forward and think that there could be the ending quotation afterward. So it won't stop there. It will match the text from the vile card as many time as possible. Then it will move toe. Next, text off to it will match it from the wild card. Then it will move. So the next one space and then explore. But when it will reach, add the ending off over Patron, It will think that I diverse the whole string. But I haven't looked into the other part off this expression. And that is the quotation right after the violent card. So it will know. Focus on the ending off over regular expression and the control will move from the representative I'll car tow the ending repetitions because we still have to match this ending quotation. So from the last, it will backtrack toe e and try to match this ending string. This ending quotation with this e. But it won't find it there. So it will back drag again on our in the word off. Explore. Then it won't match the quotation. So it will backtrack again on all than l'd and P than X than e then space than order and t dense space. And then right there, right after text sees it will find the ending off quotation. So it will say that Oh, I found a match right here. So what? I really wanted to show you that did. Regular expressions are by default greedy. They will try to match as many as possible from the 20 fires when the testing ends. Then they try to move, do the next part off the expression and in our case, it waas quotation. So David backtrack again and try to match the ending so that they could complete their search. Now let me show you one more example so that you can understand this kitty concept completely. So here is one mawr expression right here. First I got wild card and then I'm using static 25 0 many times to repeating the wild card . Then I got 029 range also repeating it with plus quantified one or many time. No. Suppose I have the string off Agent space Double 07 So this first part off a regular expression viol guard that is repeating by a quantified static will first start, Dave. Okay, so this vile card, this daughter is going toe first match A than this G will be matched with other viral card because it's repeating than Eden end anti and then space. Then, as I told you that regular expressions are greedy so it won't focus on the next part. The 0 to 900. It will still match this digit Part 00 salmon from the vile guard, not from the rain, dude. Oh, greediness. So this viral card will match 00 and salmon and Venice done it, Will look, are dying whether it has anything left or not. So it will say that Oh, man, I didn't look into the second part off the expression. So it will backtrack one time and take this seven from the other part off expression. And that is 029 range. So in short, due to the greediness off regular expression, the quantify IRS always wanted toe match as many as possible. And when the complete the string, the backtrack and try to look into the other expression part and match tiny bit from there 20. Lecture 19 Lazy Expressions: the lazy, more off 20 fire is an opposite toe. The greedy more, as we saw earlier. Greedy More tells the peat maximum number off time, the quantified as possible so the lazy more will be the Pierre de quantified minimum number . Off times, the notation off lazy expression is very simple. All you have to do you have to put a question mark toe. Make your quantify lazy to make things clear. Usually, a question mark is a quantified by itself, zero or one. But if we add after another quantified or to itself, it gets another meaning. It's which is the matches more from greedy, too lazy. So as we have these quantified, static, plus and custom are static means zero or more Time plus means one or more time and question mark means zero or one time so we can make all these quantified, static plus and question mark into lazy expression by adding a question mark right after every single quantify. So it's gonna make all these expression Toby Liz, Eamon instead, off greedy one. Now let's see how these lazy expressions work. So, for example, we have a same stuff. String Earth has mountains and many seas to explore, and our regular expression will be the same as we had earlier. We got quotation than regard wildcard, and we are repeating our wild card by using quantify. Then regard the quotation and jeezy more right here. If you want to make this regular expression, Liz, Eamon, you just have toe Are the question mark right after your quantified off. Plus, So it's gonna make this whole regular expression Go use the approach off less human. So here is our regular expression that we made by using the lazy approach and hair is our string. Now we made this regular expression to be lazy One first it will look for D quotation, so it will look into our string and find the quotation. First it will come toe the text off Earth than has it won't find the condition there. So right after has it will see the space and right after the space it will find the quotation now, after finding the quotation. Nor the second part is the vile guard repeating one. But as we made it to the list semen. So instead off looking and finding and matching something from the viral guard it will go to these second expression and say that I'm the lazy one. I just want to sit here. This whole wild card will say I just want to sit back and left. Give control to the next part off the expression and that is ending condition. So it will match the ending quotation with them when it won't find a match with M viddy. And in quotation it will give control to the vile card. So this M Bill Matt the divide card. Then, after matching the vile card, it will give control again. Toe the second part off the expression and that is the ending quotation by because the vile card is the less even and it will try toe give control to the next part all the expression . So this all will try to match with the end in quotation. And when it won't find the match, the ending quotation will give control again to the vile guard and then oval match with divide card. Not in next is you in our mountains. So viral card will say that I'm delays. Eamon, could you please done this work on my behalf? Because I cannot do it time, the less even so the control will move again. Toe the ending quotation and then you will match with the. Then again, the control will move to the vile guard. But it's the less human, so it will give back the control toe the quotation, then moving forward. It will match all the things, tell the mountains and then regard de quotation. So so first, our regular expression. I will ask to the wild card to Mac this quotation. But our vile guard is the Liz. Even so, it will give control or to the next part off the expression. So this ending will match with the ending off quotation in our regular expression. Now, after finding the match, it will say that it has found one match, so it will try to match again the regular expression with the other part off over string, the dress part that we have not checked yet. So it will try to find a quotation, the start in quotation again, and it will find the starting quotation right before sees. So it will match the starting rotation with this quotation that we guard before s. Then, after finding it, the control will move toe the viol card but it still is. Even so, it will give control toe the ending quotation and say that all quotation Just look if you can find the match because I'm the less human so you can check first that, uh, you met yourself into strangle? Not so The quotation will try to match with the yes, but it fails so the viral guard will matter the s then for the E indices tax divide card will give control again toe the quotation. But condition will say I cannot match this because e is not like me. So you have toe match it wild card. So the match will be done by the viral card. So as eso as us. So now for the end in quotation the quotation will match ending gradation in the string first and it will say that I phoned him at so this match will complete and we will end up by having two matches in this string. Now the same technique could be achieved if you create a regular expression, something like this. So if you don't want to make this Liz, even you can make it quotation at the beginning Then you can put quotation in the character set and make it not by adding scatter symbol. Then you can repeat it as many as time possible. So this whole one means that look for anything other than quotation. And when you are done, then you can look for the ending off the protection. We were tried in a moment. Now here is one more example that we've seen before. Now we are doing the same thing right here, but using lazy approach. So the first part off the expression is the viral card and repeating yourself. But by putting question mark, there still is even, and the next part is 029 range. Now this thing is starting with a now before a the next part off the expression. Our regular expression 0 to 9 will take control because the second part is not delays. Even however, the first part is the less human, so the first part will give control to the second part. 029 range and 09 in ranges, Repeating by the plus Quantify So before a it will try to find any digit add the first whether it got any digit at before air, nor so many it will not find any. Resist There it will give control in the string to a and in the regular expression. It will try to match the A first with our ranges off beggars. Because this one is not delay Zemun. So it will match a bit over digital. But it won't find any a match with over digits strangers. So the control will move to the viral card less human so able match from the vile card. Then before thingy, the control will move to the 0 to 9 drained by because the viral card will say I'm delays, Eamon. So could you please check it first if you can find anything so this D will try to match with 0 to 9. But it won't find a match so that control will give back to divide card and de Ville Matt from Div our car than even try to match from the 0 to 9 ridge. But it won't find a match and e will be match from divide card. So as n so esti and Suez Space No, Right after the space Did regular expression well again. Give control to the next part and that is 0 to 9 range because the first part is the less. Even so, it will try to see whether it could match the zero from the 0 to 900. Because the vile card, the first part will say, Well, I'm delays. Human. Could you please check it if you can find anything or make it useful for you? So this zero will match from the change. So it will say that Oh, I phone a match in the second part. Then the 2nd 0 will match from 0 to 9 range. Then the last salmon will also match from the 0 to 9 range. And then we will say that we found a match. No, let's run this in our rejects 11 dot com so that you can see that words we are finding 21. Lecture 20 Greedy Lazy Testing: now here is our tester. I added the testing already that we just saw in the last couple off movies and in the regular expression. First, I'm gonna show you the greedy approach. So first I'm gonna match the quotation, and then I'm going to define the vile card, and I'm going to repeat it by using the plus quantified. Then I'm gonna add the ending off our quotation. Now, see, we just match this part off our expression by using the greedy approach. This is the greedy approach that used by default by regular expressions. Now, if you want to make this expression to be lazy, man, you just have to wear the question mark right after the plus. No, See, on the blink off I the desert in dark testing the matching has been completely changed. Now you are finding two matches from this dust ring. And before you was only finding one match from the testing No seat. Again. If I remove the lazy one, we found one match. And if I add the Liz Eamon, we're finding too much. So remember that by using greedy and lazy approach, you can hear a different result from the same test string, so be certain about using these approaches. Now, let's try the other example out. So regard the testing off Agent space Double 07 And for the expression, I'm gonna are divided card, and I'm going to repeat it by static. Then I'm gonna add the character ranges for digits 0 to 9, and I'm going to add the plus on these ranges as well. So this is the greedy approach. If you want to make it, lady, just are the question mark right after the static. Now you can see that there is nothing different in this expression. If you use giddy approach or the lazy approach, you are still getting the one match. It's due to the test string because we don't know how the things are working backwards in regular expression engines sparser. Then you use creedy or lazy approach. But in the last movies assured you completely hard Thies too greedy and lazy approach book . So on some expressions you will have the same reserved for your greedy and lazy approach, but it possible that you could have the different result on different expressions. What really important is you should know how the greedy and lazy approach work actually behind the scene and at which I showed you in the last movie. Let me show you one more example off the zemun. Right here. So I'm gonna add here when pestering off. 123 space 456 And for the regular expression, I'm gonna have an expression here. Now, before putting the regular expression here, I just wanted to show you that this will be the our expression that we're going to put right here now before putting it right here. Tell me what? It's gonna match this expression. Hold on. No, Let's try this expression, old. So first, I'm gonna add the digit. Then after digit, I'm gonna add the plus so that it could repeat itself. Then I'm gonna add the space after that and then did you again? And then plus, for repeating itself, then? No, I'm going toe adhere question. Mark toe. Make it lazy. No, you can see that it only match from 1 to 3, then space. And then for so what's really happening here if you're reserved, which you guessed wasn't accurate, According toa these reserve that we're seeing right on the screen. It's because for the testing, this digit is repeating itself. So it gonna match the one because this is the lazy part. So it will stay back. So this one will be match from the digit two will be match from this part three villa marriage from this part than the space will be match from here and then, after matching the space decontrol will move to the second part off the expression it can't go back. So this four ville match from this digit now, after matching four. Now you can see that regard the question Mark air, which is making this expression this digit plus question. Mark this lazy one, Toby Lazy. So after matching before it will say that I'm the Liz Eamon, I already matched one digit. So I'm not going to match anymore. Deters So this match will be starved right here. In case if you add a couple off more strings right here, for example, if I add Ah 7896 And then I had space. No. We match all these digits from this part. And then we met this base destroyed hair with this one. And now if I add five, we found a match again. If I are six, this six is going to be matched with the next part. So there's how the Lazy Expressions Book remember just these two things that greedy moored repeat maximum number of times from the 20 fires there. As the lazy more will try to repeat minimum number of time from the quantifies, which is Liz Eamon by adding the question mark. 22. Lecture 21 Groups: hello. In this lecture, we are going to learn about groups. They are very useful and we use them in regular expressions all the time. Whenever we have to create easy or complex rejects, group notation is in matter characters. We start our group by adding starting apprentices and end of a group by adding the ending apprentices. Ah, for example, if you have a regular expression, something like X Y Z, and you put it in the group and then you can repeat this group by adding the plus quantify so it will repeat it by one or more time. So this one will Matt detest Ring off X y Z than X y z X y Z two times. But it won't match with X y z ex Sesay because C is not lie in this group. Similarly, if you have a regular expression off A to Z plus 0 to 9 and you made your range is 0 to 9, Taubate within 0 to 3 limit means you can have number in years from zero time one time two time or three times, but not more than treating. Then after number edges you guard space and then team So you can say that the first part is with the A to Z range and 0 to 9 range withing 20 fights. So you can put all these one. I didn the grope so that it could make your regular expression much more easier to read. So first we guard one group, then regard space, then regard simple text off team. So this one will match the test string off zero team because we can take the text off their e r off from the ranges off a to Z Then in the second part 0 to 9 ledgett ranges. We can take nothing because we've made it Toby zero or one or two or three times zero is the minimum one and trees the maximum denim regard the space and then we got the team. That's why we match zero team. This one will also match Long Island Space Team because we are still doing the same thing here we are taking Long Island from the Z part. Then we are taking nothing from 0 to 9 number ranges, then spaced and team. But this one won't match with beach double salmon, double salmon dash team space team by because first we're taking beat from a to Z range. Then we are taking four digits from the 0 to 9 ranges and we made this rain Toby 0 to 3. So we cannot take four digit from the Angel zero tonight. That's why this one won't match. But it will match with Red Bay people 17 space team by because we're taking the drag bay from the first part than triple sound from the digital London space and then team. So what we're doing here we made the optional part, all the numbers, all the tax into groves to make it more understandable because then we have the spirits and team. That's why using growth hair could be very beneficial for you to read your Reg. Exe So what we end up by using groves is first off. All groups are very easier to read. They make your regular expression Ah, lot easy for the other people to understand and treat them. No. The biggest advantage of using groups is you can find some specific tax and you can also replace the text with some certain things. We'll see finding and replacing after a couple of movies how you can do that by using groups. But here is the thing you cannot used group inside your character set. So remember that. So now let's try these simple groups out. So first I'm gonna create a legal expression off X y Z and let's put it and grow up and let's repeated so it will match X y Z. It will match X y z X y Z, but it won't match with X y z c Z X because Sea does not belong to this group now. Similarly, the expression that we just saw now for this second example, let's put the testing here. No, let's create a regular expression which could match the certain number off festering. So it was easy and repeated for one or many time. Then you could have The range is off 0 to 9 and you can make it toe repeat from 0 to 3 time and then you can have the space. And then so it will match all these three months, but nor the Beechman. Why? Because we are getting the four digits here. And we made this Toby use only within zero toe 31 so dollars put all this into one group so that it could be more understandable. Now you can see report this when Toby in the group and ah, it's also highlighted all the things in tow Greenman, which belonged to a certain group. So it much more understandable for you so anyone could see this regular expression will say that this team and space is the necessity part are demanding, and this group is the first, but 23. Lecture 22 Alternation: remember back and character chapter we learned about director said Image. We put different items and we can take any old item from the collector set. So what we were doing there we were making a choice from the character set. But that's not the appropriate way to make a choice. So what is the most suitable there to use the alternation and make choices in your regular expression? Well, the regular expression have a separate meta character for making alternation, or some people call it making a choice. So the notation in meta character for the choice or ordination is the by symbol. So we used this five member to make a choice between two things or more than two things. For example, if you have a regular expression off boy or girl and you want to match something out off this regular expression so you can make the twice Toby boy or so this five symbol, this alternation will be treated as the or here, so this regular expression will match detest ring off boy, and it will also match the test ring off go. But this regular expression won't match with detest ring off boy girl by because you can only pick one item from this rejects. You can pick boy or girl. You cannot pick both items at the same time. So alternation five symbol is all about making a choice in your regular expression. Now, this regular expression won't match with any other text. As usual, it won't match with man as well. Now, For example, if you have some a bit complex regular expression like this in mid first you guard the text . I think that space Then you can put many items as alternation. So I put hair Pakistan, India and Australia here as a choice. So as we are putting three things here in this string, so it's better to make this alternation inside group so that our regular expression will make much more sense. Now if you don't add Prentice's toe, make them grow, then the first ordination will be. I think Pakistan 2nd 1 will be India, and the 3rd 1 will be Ost area. Will Vina work up 2000 and 50. So if you want to make a choice between two things and more than two things must use group , so this regular expression will match the testing off. I think Pakistan will win. Ah, work up 2050 I think Australia will win a work of 2050. I think India will win our top 2050 but it won't match with. I think America will be in a work up 2050 by because America is not as a part off over choice. It not lies in our group off alternation. Moreover, if you ask me to be certain, I'm talking about cricket here and America doesn't have any cricket team that could play in a worker Enemies. Let's try these regular expressions or for donations off so over first regular expression Waas boy and then regard ticker. But before that, let's add the ordination by symbol And then I'm reading girl here. So no, this one will marriage detest ring off boy. It will also married the trusting off girl and want match with boy girl. Although it did, I like it the whole one just because I'm using the global Mort right here. So if you can notice here, this one added the space here which indicates that boy and girl or the simple separate testing Let's remove this boy a girl and dollars Don't off this global more. Now you can see that this one just met this one Just mag boy, But nor Diggle. So this whole testing off boy girl is fared No other striding as the example out. So I'm gonna turn on the global more first. No, let's add the string here, Toby, I think first waas Pakistan in the and also let give it to ice off Australia Ville Finn Ah , work up. No, This one is the door to alert also escape this one as well. So no 40 testing I'm gonna add here. I think Pakistan will win. Ah, word up. No, see here it matched the I think Pakistan by because we didn't put these three ordination items into groups. So don't do that. Always put your choices inside a group. So I think Pakistan will be in a work up. We need daughter. So we mashed this one and you can see that this one is coming from the groups. That is what is projects 11 dot com tester highlighted this group so this one will also match. I think in BR will win a work up and it will also match with I think, ah stadia with middle of World Cup, but it won't match with I think America will win a World Cup because America doesn't belong toe our group off ordination. So using these ordination could be very useful for you in your regular expression when you have to make choices within your rejects. 24. Lecture 23 Nested Alternation: in Order Nation. You can also do nested Alternations means Alternations, bidden, Alternations. For example, If you have a regular expression like this image first you got a group off U. S and China and you made our choice between these two countries. And you said here USA or China likes blue and then you have Russia or Canada like screen. No, You can separate these two different scenarios using nested alternation by because you have already got two Alternations. Now, if you want to separate them, I want Oh, Big One scenario. No. First off all, you have to define a group that good wrap up all off your regular expression. So first I'm adding here a grope. Then I'm adding alternation between these two things and that is the first part and the second part. So I'm going to add alternation right between so as a whole regard von ordination and then within that ordination, regard one more alternation so this regular expression will match detest ring off. USA likes blue. So what we are doing here first we are giving control. So the first part off our group and that is likes blue part. Then we are picking us or China from the first part, so it will come up from the first part. USA Likes blow, but it Won't match with China, Likes Green Canada likes green by first off, all because you can only pick one scenario. Weather is blue or green and more, or China could only like blew. It cannot like Green at the same time, because it's choice is limited to the blue. The first part, and also this regular expression won't match with the USA likes Green by because USA can only likes blue from the first part off ordination. Then it will match. China likes blue, so we are taking China from the first ordination part and from the U. S. And China. Twice we are taking China, and China can likes blue. But China cannot like screen because China belonged to the first part and Green is in the second part. Now let's run this example out. So adding first off all the one group here and inside this group I'm gonna The China or USA likes blue. No, let's also put this China and USA inside one more group because regard the alternation here , and then I'm gonna add the one more alternation here on dollars start our group. So 1st 1 will be Russia Choice Or or Canada likes Green now closing this whole string. And ah, you can also pick this one in tow. One more group if you want. So let's not put this one into group. So I got first this sky blue group You can see it's ending. Then I guard this group within that group I got first alternation and then I got this group right here. We didn't that we got ordination. Now under testing, I can adhere. China likes blue. If the Lord so match. Russia likes green. It will also match. USA likes blue, but it won't match. USA likes Green Bean because we guard the alternation here. So it's a very good practice. If you could wrap up these ordination within one more group so that they could be more understandable. No wrapping up this group as well. See, So this is our group of China and USA then regard this group that indicated the first part , then regard this group off restaurant Canada, then regard this group off second part. And then we got this group as a whole that capture the whole regular expression. So this is how you can do nested alternation by using groups and five symbol. 25. Lecture 24 Anchors: So far, we have learned about literal characters, corrector classes and the dot means wild card. Putting one off these inner rejects tells that rejects engines toe try to match a single corrector. But the anchors our bit different breed. They do not match any corrector at all. Instead, the match opposition before, after or between corrector, they can be used toe anchor. The rejects match at a certain position. So remember that the anchors that we are going to learn in couple off minutes won't be a director. The just Jews toe represent position. The first Anchorages dick scatter symbol that we used to match the beginning off the string or line, then seem like Garrett anchor. We have the dollar anchor that we used to match the certain position off the string, but not deep. Beginning, we use daughter Simba to match being end of the string or line. Now both these anchors are supported in all regular expression engines. Now let's try these one or so that you can know what they can do for, you know. For example, if I have ah, burger expression off gather symbol A. Then, as I told you, that scatter symbol will represent the starting off the string, the starting position. So this one will match detest ring off just a now. For example, If you have a character, string off something like Vier Tsosie and you repeated couple of times So this one will match it and we have to pick something from divide with the portion so this one will match . So this one will match a by No As I told you that we use dollar to represent the end all the string So for example, if I have ah end of the string Oh, and I are the dollar here. So this one will means that our regular expression must start from the So this carrier symbol says here the first position must be a and this dollar symbol is saying here our ending position off regular expression must be off So this one will match is the O And if I adhere if I o this one is not matching a Vaio and also it's not matching with is you buy because, as I told you, that scatter symbol and dollar represent only the starting position and the ending position regard. The starting position is a and the ending position is Oh, right here. And as I told you, that dollar represent the ending off our regular expression. And here we are, adding a couple of more things after finishing our volunteer. So we have toe done on our multi line moored em so that we could mash the ending string here. So whenever you use scattered symbol and daughter must on the Murti line more now this one will match a by Or but this one won't match a x O because X is not belong, toe this arranges part. Now let me show you some of the more example for the multi land More so I'm gonna add here First off all the starting position, Toby A to Z means anything. And then I'm gonna add her dollars symbol that would represent that the ending must be the position within these ranges. So this one will match color off Red blow, Jello green black. And also we do have to repeat it so that we can take one or many things from here. So this minimal match all these things, if I turn off the market and more, it's not going to match so always use myrtle and more whenever you have to use the catamaran dollar. And one more thing I want to show you right here we saw the gutter symbol before When we use the cattle symbol inside the director ranges toe neglect something like this. So if you want to neglect something, you should put gathered symbol inside your character set. And if you don't want to neglect something, if you want to start some position or the regular expression, you should are the scatter symbol at the start. Now, for example, if I add one more range here, Toby zero toe nine. So this one will say that don't match 029 range. Now, if I adhere it, you can see that it is not highlighted. And you can also notice that we are matching the whole line just because we would your Arctic gather symbol to Magdy start off the line. So remember that when you have to neglect something, you can are the scatter symbol inside here so they get a symbol won't match with anything within the character set. And if you don't want to neglect anything, do not pour Decatur symbol and always put you're carried symbol at the start off your regular expression and the end off your regular expression did dollar simple and most importantly, using multi line more. 26. Lecture 25 Another Anchors Example: no one more example Here, for example, if I have a test string something like this and ah, a kid. He ate a regular expression that first match Capital A to Z and the start off our line. So this one will match the start off our testing and other stuff Testing Start from the Etch Regard the capital right here Now, Right after that. If I adhere, Lord A to Z And then I got a potatoes. He also and I repeated couple of times. Then you can notice here we only matched just this text off high. We're not matching the whole one. Why? Because we do have something more hair like coma. So I can add this coma inside the character ranges. You can notice that we do have to add the space inside this character string. So if I add hella space now, you can see that we married here Now. After that, you can notice here that regard the dart. No, you can put this door inside here, but it's going to repeat it. Repeat the whole character set Now, For example, if you have tow find first sentence off your testing, you can do something like this, but your sentence will complete are the dot So you have tow air the door right after you're repeating characters that so? No, this one is only matching the first sentence off your does string. Now what if you want to match the lost sentence off your testing Now, you can do that by using the dollars. So I'm gonna remove all this regular expression from here. And first of all, we need to grab the ending. So I'm gonna add the dollar here. Now we grab the ending. Now, after that, we have to create our regular expression back. So I'm gonna add first the dog and let's also backslash the dark. So then I'm going toe have the A to Z or capital A to Z ranges. And let's also repeat it as many times as we want. But after that you can see that regard the space here so we can add the space right here. It will match that regard the single string. So I'm gonna add the string here. So it matched the ending. But it could also possible that if we could have the I in the lower form, it will manage the same. But if you are matching the loss intense as the sentence, start with the capital in, so you can add the A to Z uppercase range. And also there could be possible that there could be some sort off coma there. So this one, this simple expression could give you the opportunity to find out the last intense off Your better get off. And if you want toe, find out the first sentence off you're a paragraph. You can do that. First you have to remove the dollar symbol. Then you have to grab the first position by using the carrot symbol at the beginning. So it will match the first sentence of your paragraph so that how these anchors carrot and dollar could be very useful for your toe. Find out the start and off your best drinks. 27. Lecture 26 Other Alternative Anchors: now here are a couple of more anchors to explore. For example, we have backslash A Dax is there. The match must occurs at the beginning off the string but it does not support multi line. Then we have backslash. The that is that the match must occurs. Air the end off the string or before the end off the line so you can think off backslash a as the scatter symbol and you can think off this dollar as the backslash Z But the sport for backslash a and back slash z it bit different. The only sport in Norton at fightin PHP, Ruby people and Java. And of course, the backslash lower the is opposite to the backslash capital T same what we saw with the capital WN Lower w So I'm gonna add here a string off m is my name a couple of times. No, as I told you that back slashing and back slash Z books like Gary symbol and dollar. But this sport only daughter PHP python, Ruby Poland Chopper. So I'm gonna add her. I m is my nam. No. First of all, I'm gonna show you the backslash A as it worked quietly as the cattle symbol. So I'm gonna add here backslash a It will match em is my name. I find a move back slash a and if you want toe marriage, the last one you can are the backslash C. It will match the last one. If I turned off this multi line M ward, you will see that it's still matching the last one. So backslash a quietly work as scattered and back slash z quietly workers dollar. So instead of using backslash air and sea, you should use Garrett and dollars involved because day sport in all regular expression engines. 28. Lecture 27 Word Bounderies: the meta character slash b is an anchor, like the carrot and the dollar sign. It matches at opposition that is called a word boundary. Actually, there are three different position that qualifies as word boundaries. 1st 1 is a bird born breeze could be before the first corrector industry ing if the first character is a word corrector. And when I said word corrector, I mean a to Z lore A to Z Capital 0 to 9 and underscore. You can think of it as backslash W. The second condition is after the last director industry ing it. The last director is a word corrector. Then you can also put the word boundary at the last character. And for the third condition, you can put word boundaries between two characters. Industry ing there. One is a word corrector and other is not offered corrector, so simply port slash B allows you to perform the whole verse only search, using a regular expression in the form off slash b word slash B. A word character is a corrected that can be used to form words all characters that are not word characters. Oh, non word characters no divert Borders are supported in all regular expression engines except for UNIX or tools br eas. And also remember that bird boundaries have zero length or you can say zero of it. They don't take any character as thes space or underscore. Take the just used to show the word boundary. Let's try some examples are so that you can know what bird boundaries are now. For example, as I told you that if you want to define a word born, do you have to wear back slash B. Then you have to define anything that you want. So I'm gonna add here back slash w and repeated couple of times. Then I can wrap up this word corrector inside one more ending word boundary so this one will match jazz ib a gram. This one will also match Josip Underscore a crumb. But this one won't match Joseph Dash Akram by because Dash does not lie in divert directors . That's why this match will fill. Although it's do highlighted, the government does it part but nor the whole one. No, this one will also match Judge a 12345 a crumb. No, let's try some other examples out so instead off word corrector and repeating it. If I adhere, Dash And if I try to marry detest ring with the dash I won't find any match by because Dash does not belong to the word character. That's why we cannot match the dash now engaged. If I have something here, Toby pestering off roses Ah, rag. And if I have ah, regular expression off roses, then if I add hell burn boundary off are And then if I add one more word boundary here and then add red then you can see that it did not find any match by because I told you their space is excel for character. So we, um, missing money director here. So I have to add the space here. So what we got here in the word boundary, we got our in the word boundary. That's why we found a match. So always remember that word boundary is not Ah corrector. It just anchored to represent position off word collectors know for example, if you have a test during something like the simple text which I just port here and ah, you have to define the word boundary for the lower ones, so it was easy repeating it and then the ending word boundary so it will match all the things, all the characters that does not have any kind off other than word characters, but should be within the lower fall. You can also define the word boundary for the upper one as well. So we got only one word born during here, and that is I because before and after I we guard other than Vered characters. So Dash does not belong to the word corrector, and also door does not belong to the word corrector. So whenever you have to use the word corrector, always try to air the word boundaries around your word characters so that your regular expression engines could give you the word characters and only word corrector match. 29. Lecture 28 Capturing and Backreferences: remember back in the group lecture, we talked about advantages off using groups, and I told you at that time you can use group, toe, find and replace text. But here is the question how the name on Earth Group is going to help you find and replace that text. Well, it's gonna happen by back references. So when you kill year ah, grope your regular expression engines, capture your group and create one address off that captured group. You can call this address to be reference, then, by using that reference that address it follows you toe the use that capture data. So buyback references. You can use the previous captured data that you wrote in your groups, so the growth stores the mass data, but nor the expression so that you can reuse it. And it's automatic by default, not innovation. Off back references is according to different engine most engine sport backslash oneto, backslash nine as a back reference, while some engines sport dollar oneto, dollar nine to back reference the captured groups. And remember, you cannot use growths inside your characters are We have discussed it before in the group lecture. Now let's see how it's gonna work, how you can capture growths and then using back references to use the captured group data. So here is one regular expression a b in the group and then CD in the group. And then I back reference backslash one backslash toe toe. These group So first backslash one belonged to the first group off a B and second backslash toe belong to the second group off CD. So instead, off seeing backslash one nor backslash toe, you can think off them as a B one more time at the place off backslash fun and CD one more time at the place off backslash toe. So we are using the back references so that we don't have to write again A, B and C. So this regular expression is going to mak detest. Ring off a B C D from the group. Then next a BCG from the back references. No schools. You have the string off. Bruce when Bruce someone's name and this name is repeating Bruce twice air the beginning and air the and so first you're going to put vein, not repeating one in your agree expression. Then you can put the first Bruce Intergroup Now you put this Bruce inside one group. So it means that by putting Bruce inside group, you captured it and know you can use back references to do. Use this Bruce without rewriting it so you can simply put back slash one, which is going to match the Bruce Van Bruise. So this regular expression is going to marry detest Ring off Bruce Wayne Bruce. No, let's run them so that you can see how things are working in your tester. So our first group Waas A B and C D. Now you captured two groups, and now you can back reference these group to use the data that you stored inside your groups. But before doing that, first, let's air detest ring off a B C D. It matched. Now, if I adhere a B, C D and then a B c D, you can see that we own the global more. That's why it's matching. So let's remove this one, and let's turn off the global more. Now you can see that we only matched a BCG. No, you can re use this data that you stored in first group off a B buy back reference and 41st back reference. You can do that by backslash one. So now you can see that we have made toe a B. So you can think of this as a BCG than we are using a B again here. If I adhere backslash to, then you can see that we captured the whole testing. We matched the whole testing. So this backslash toe represent this CD on this bath slash one represent a B. Now, if I remove this backslash one from here, we're not getting any match. Why? Because this second backslash to reference belonged to the CD because CDs over second group and this CD belong toe the 2nd 1 That's why we are not having them at because first regard the baby, then regard the CD. Then we guard the back reference off one which we don't right here. Then regard the serie Now, if I remove this CD from here and now you can see that we got a B than city. Then we guard the back reference off second group nor the 1st 1 So if I adhere city now, we found a much Now, in case if I have many groups like turban Toby Josip. Next one, Toby a Crumb. And no, If I want to use this fourth group off a gram right after this second group back reference , I just have to put the number off this group and this group has the number off for So this one will match first a B. This may be done. CD done, Joseph, Of course. Then a gram off course. Then we have to pour the second group. And our second group is CD. And now we have to put over fourth group. So our fourth group is a crumb right here? No, we phoned a match. No, let's try the other example here. And other example. Waas Bruce Space. When then Bruce again now in the festering. If I put her bruise then Bruce, we found a much. But instead of putting the Bruce again instead off that if I put her back slash one, you can see that we guard the patter vie because we didn't put the first brews inside the group. So remember that if you want to use the back references must put your the desire taxed inside group because as the groups are captured by the four and you can only use your groups by using back references. Now you can see that we found a match. So using groups are very handy because you don't have to write a lot off things again and again. And it saved your a lot off time to read writing your rejects when you were writing longer , regular expressions. 30. Lecture 29 Capturing and Backreferences Examples: No, let's see a couple of examples off using groups and backer offenses. So the first example we're going to see here finding the dual words in a text. So I'm gonna paste here some dummy text and all ex created one rebel expression that will give us devore words which are repeating in the testing as we are going to create a regular expression that will give us divorce, which are repeating just the word so we can use the word boundaries to be certain about the words only. So I'm gonna add the word boundary And inside this world, born, I am gonna for select all the words by using the word plus no, let's also turn on the global mood here. Now you can see that we have highlighted all the words which are, Lord, it was the capital A to Z or 0 to 9. But let's find those words which are repeating. So as you can see that we captured Deaver's inside one group so we can reuse this capture data so that we can find the words here. So I'm gonna back reference this words character. So I'm gonna back reference it with backslash one. Now you can see that we don't have anything here. As we are capturing the word which are repeating sorts possible there, that word could have the space between the two similar words. So if I adhere space now, you can see that it highlighted the world and D off. Do it is because we have put the plus outside off the captured group. If we put this one inside the group now you can see that we found two words which are identical and you can see there. Many is repeating right after it just have this pace. Now, if I add a couple off more words here that could repeat like Gord Gord, you can see that this one is also highlighted. So by using this simple logic off using the capture group, you can find out the words in your text which are repeating. Now Let's see the other example, and that is to match the esteem or tag. So I'm gonna create her a regular expression. I hope you're known the HTML tags which have the ending and this starting off the tag. So suppose we have a tag off E. M. And in the ending bag. We have the forward slash, so we also have to escape it. Now, inside here, you can put anything. So I'm gonna put here the word corrector from A to Z Capital A to Z next. Also are the space and that's repeated couple of times. No, let's also used distrusting and sort off creating something new. So I'm going to wrap up inside when e m tag? No, As you can notice that regard couple off go mind dot and post office sign. So we also have to wear them. So first starting the coma, post office sign and the dart. Now you can see that we found a match. But what if you have some ending Toby B instead off E m tag? Now you can see that we don't find any match. Why? Because testing guard the E m tack and in the regular expression, regard the Peter. So we need to come up with one regular expression that could let us match the ending and the starting off any esteem attack. So let's create a regular expression for that now. We just have to do some changes here at the beginning, off tag and also at the ending of tech. We don't have to do anything here for now in the content off four tags. So in the first angler bracket, I'm gonna create her range. As you know, they're the esteem. Attacks usually start with the tax. So I'm gonna make the first text off our starting off back to be the text one. Then I'm gonna add the one more character INGE's, because we have some tags like H one tag arrest three tag like this. And also in all these Taegu fresh burnished wares as three, we first guard the alphabet. That's why I could hear the first strangers is the alphabet and all. I heard the second position. We can have anything. We can have alphabets. We can have numbers. So let's make it toe a to Z or ranges off 0 to 9. Let's also repeat a couple of time. So as we're going to use the back references so that we don't have to write the ending good here, So I'm gonna put all of this inside one group now we put it inside one group. Now we have to focus in the middle part. So in start off defining something here. We can define the world card and we can repeat it couple of time. And now we can back reference this first anger bucket bag because we captured the group. Now we can just simply back reference this one so that we can reuse what we are getting in the first starting bag. Also in the ending tag as well without rewriting it. So that's charity backslash one. Now you can see that we phoned two matches here. We phone the E m tag and also the h one tag. If I adhere Pitak and sports something in here, I can see that we phoned also the match for the Peter. So this one is gonna work quite well for us. But still, there is some problem with this regular expression. And that is if I adhere one more ending angry bracket, You can still see that we found a much and as Peress demo. This is, nor did I write syntax to put ending angler record. So we need to escape any angler bracket that come in this starting tag. And we can do that by neglecting the ending angler bracket right here. So I'm gonna define here one word boundary. After that, I'm gonna add one character said to neglect our angle bracket. Now you can see that this one is not working by because we are neglecting the anger record this one. So as we do have the angle record right here, this one. But still, this one is not matching. So we need toe. Repeat it couple of times so that in case if we got toe ice angler Records, there's gonna skate for No. Let me devised this again for you. First we guard the starting angle bracket off HTM or tag. Then we are the range so that we could have the first alphabet, like Etch or P at the beginning, off over Esteem Akdag. Then we can have anything from a to Z or zero tonight and we repeated couple of time. Then we captured this group and we back slash one. We back reference it so that our starting and ending off our esteem Oh, tag should be same then here we start that our starting off our gmota could be anything but nor the ending angular bracket. That's why I repeated couple of time. Then I guard this ending angle bracket off our first starting back. This is the ending off over. Starting back then why was inquired card and repeated in couple of time? We are a couple of text here. Then we just back reference all off this expression. All of this captured one here. But still, we do have one problem with this one because it's gonna mass this expression off anything this people as we don't have any team antagonist Emma. But this regular expression is doing quite a bit job for you because it's matching the esteem or tags. But as the regular expression is not a language, so it cannot, I think, whether you insert the right syntax off esteem, ill or no. So this one will only match the starting and ending off esteem attacks. 31. Lecture 30 Application: Welcome back. In this election we will see one more example off groups and back references by which you will learn how you can use the identification off dollar $12.9. The back reference your group. And he will also see how you can edit your text and find and replace your text on a Fla. So first, I'm gonna drop here some testing in this Dagnall. So I have added a couple off records in the test string. If I can show you from the beginning first, regard the serial number off to religion and regard Dash then regard SS and then regard piece. And after space, we got nine digits, represent our social security number, then regard space. And then we got first name than the last name. Then regard space and then four year digit and we have total 30 that guards here, all of them having the same kind off form a serial number. Social Security number nine Dodgers first and last name and before your dessert and some name have longer length like this. 5th 1 James, the store s door. Kaka. He has dart inside the name and also his name is quite long. So first we are going to create one regular expression that could match all off these deaths. String off 30 records. So let's create one. So first, I'm gonna represent the starting position by using the Gary symbol enka so that we can start from the left side from here. Then after that, you can t regard to over the years. So I'm gonna add here, back slash dean, and I'm gonna make it toe toe digit. You can use the exact notation off cordage it, or you can make it toe one or two digit, then regard the dash. So I'm gonna use the dash air, then regard Social Security number. So instead of putting directly SSN, I'm going to use the other notation off back slash W and dollars to repeated three times, then regard the space we can add this pace directly. But before moving any forward, let me turn on the multi line more because we are using the anchor so turning on marty line moored. So instead of using the space here, if we can use back slash s, it will make much more sense. Then we got nine digits, so I'm gonna make it toe nine digit. After that, we got space again. So I'm going to use Backslash s. Then you can see we guard first name and then the last name. So I'm gonna define here when character said in which I'm gonna put back slash w then left , Repeat it by using the quantified plus ocean. Now, we matched all these records. But this fifth record also have space entire the first name. So I'm gonna hardly space here and now you can see that this one is getting the full name which I don't want. So let's make this Toby lazy one. You can see that it's getting just the one character from over name by making its lazy. So after that, you can see that regard. Last name. Here. I can use the identification off back slash month. First, I can capture this one into group, and then I can use the back stretch one. But I'm not going to do that. Why? Because we are going to see the adaptation off dollar one. So I'm gonna copy hold this one time and let pieced it right after it. And now you can see that regard dot here. So we need to add the dog. So I'm gonna hair dark here and all Solar 30 dark here. Now you can still see that we're not matching upto this one. Why? Because we have made our expression to be Lizzie. But you don't have to worry right now. No, we have to focus on the ending part, and that is back slash s. And after backsplashes we got for your digit. So I'm gonna add the backslash d and let's make these digital be exactly for now, you can see that we matched whole testing. And if I can remove this dark from here and also they start from here, you can see that we're not matching the fifth record because it's got dart also the 20th 1 God, the dart in the first expression. So we have to add the dart. That's why I did dark in the first expression to manage the string. And also, I'm going to add the dot in the second expression. Now we are matching all these records, so we created one regular expression that could mash the testing the dis former. Now, the next thing is, I'm going to wrap up this regular expression in tow some growth so that we can apply the technique off finding replaced by capturing group. So the first thing I'm gonna capture here the digit part. So I'm gonna put Prentice's around this digit barred. So we captured one group. Now, the second thing is, I'm gonna capture this group that contained the SSN, not the space. Then I'm gonna capture this group that contain nine did years. So adding Prentice's around this group No, I'm gonna capture the next group that contain the first name. Then I'm going to capture the next group that contain the last name. Then lastly, I'm gonna capture the last group that contained four year digit. So now we have made six group and we are still matching everything out. So now you can see that we got total six wrote. This is our first Cope. This is our second group. This is the third group that regards space than regard fourth group that represented her first name. Now let's add one more space here so that our first name will belong to our fourth group and our last name belonged to our fifth group. This is our fifth group and then we have space again. And then we have sex group now. Esper Group capturing this is over back slash one. This is over back slash two dishes our backs last three backslash four, backslash five and backs last six. But as we are going to use the orientation off dollar oneto dollar six So this one will be our dollar one. This one will be dollar to dollar tree and dollar for dollar five and dollars. Six Now for using the other notation off dollar one and we're going toe Find something by using this regular expression and we're going to replace it or shift some groups with each other by using the other notation. So the engine I'm gonna use will be Notebaert Plus plus, which we used to write court for Web development. Here, I got Notebaert plus Plus I'm going to open it. You can use any off the router bit you use to write Web development code or esteem. Oh, you can use breakers, comodo, air town, cold lobster or any any tribute you want. I'm going to use door part plus Plus, I have this file of basic underscores start txt so first, I'm gonna copy all these testing by control A and control. See? And I'm gonna paste them here in this file Off basic underscores records Door Txt No. By pressing control plus f, you will see the place tab or instead, off there you can press control plus edge and you will get this replaced tab right at first . Now, in defined tab, you can create your regular expression directly right here. For example, if I could hear some regular expression like the one that we just created first anchored than we got backslash de 1 to 2 times now effect click on defined one. Now you can see that we are matching 1st 2 digit After that we got dash You can see we are no matching dash After that regard backslash w three times for click on Defined one. Now you can see that we're matching till Masterson So here in defined what field? I'm gonna pasty regular expression that we created here. So I'm gonna cut this regular expression from here and I'm gonna baste it in this tab off. Find what? So I pasted the sexual expression and make sure you have selected the search more to be regular expression. I have checked this radio button off the regular expression. No, this part is the dollar ones. So I'm going to use the other group capturing technique toe make changes in this file off text one, this is text file. So first you can see that we got back slash the one toe that represent our captured group off dollar one. We are talking a generation, and then you can see that we got dash air. Someone are the dash. Then you can see that regard this second group that contained the SSN. So I'm gonna add dollar to for second group. After that, you can see that we guard this third group that contained nine did years. So I'm gonna add first the space because regard for space than regard 90 years. So, after adding space, I'm gonna add a dollar to you to represent our third group. Then you can see that we got space again. Then you can see regard the group that represent our first name, this group. So I'm gonna add dollar for then after that regard space. And then we got fifth grope that contained the regular expression off our last name. So adding dollar five here, then we got our last group that represent four year digit. So first I'm gonna add this based Then we got our last group. So no, we captured these group and we back referenced them in our tab off replaced with. So now effectively gone defined one you can see we are finding the whole tab. If I click on this replacement, you have to focus here. We are not replacing anything by using the captured group. It's because the dagger expression in define what tab It seemed as the back references that we got in replaced with tap. So first, I'm gonna replace it with Colon instead Off dash, you can see that regard dash here. So I'm gonna remove this dash from replaced with Tab and instead off that I'm gonna put hair Poland. So I'm saying here, find the dash in this file and buy back reference jane dot Dash deform it off Poland. So no, If I click on this replacement, you have to focus here on this dash clicking on replace which in this Golan which in second , 3rd 4th 5th 6th 7th 8th 9th 10 11 Or you can click on the replace or to replace all the format. And now you can see that every single record has fallen instead off dash. No, If I click on just defined one, you can see that we're not matching anything with this regular expression. Why? Because we have change everything in this file. And now this file has some other regular expression. So if you want to match these records, you have to put colon at the tab off your find What regular expression instead, off dash. So if I put here colon instead off dash, if I click on define one, you can see that we found this record than this than this one. Because this regular expression is no matching with distract. The next experiment is I'm gonna change the first name with the last name. So what we're going to do here we are going toe place. Our first name are the position off last name and last name Air division off first name. So what we're going to do here we are going toe interchange the order off our fourth growth with the 5th 1 and our fifth group with the 4th 1 So now if I click on the replacement, you have to notice here in the first and last name working on the replace one. Now you can see I made us Jill share here, Toby Shahida Cell. And now focus on this Malik Nuruddin. If I click on the replacement, it has become Norden Malik. If I click on the next one s order Steve, it has become Steve as dot order. Now, if I click again on replace the name Tim Marker Gene will be marker gin Tim. Then we got no Sirhan. If I click on the replace one, it has become hard NASA So Ahmad Rashid will be Rasheed Ahmad Lini. Joy Well being Joy Lini Cook Halverson will be Halverson Cook Cook a Leicester will be a Leicester cook and so on. Or I can click on the replacement to replace all the records. All the first name with the last name like that By just one click I got just 30 acres. So instead of that, if you have 30,000 records, you can change their order or make appropriate changes on one click by using the power off back references and the regular expression No. I'm gonna make one more change here. You can see that. We got four year digit here, right? Aired. And And this four year digit has the back reference off dollars. Six. So indeed, the place with Tab I'm gonna add back slash six, then coma. No. If I click on the replace one, you can see that with James. First record 1990 Toby 1990. Coma. The 1991 coma Nitric nine Coma, 2000 Coma. 1961 comma 1997 coma. And also, we are changing again from first name to last name. So instead, if you don't want that, make this Toby Dollar for and Dollar five. Click on the replacement were changing. Just the last group dollar six. We're not changing anything from the group of fourth and 5th 1 clicking on replace so no, If you click, replace all it is going toe place Coma are the end off everything 32. Lecture 31 Non Capturing Group: in the last couple off movies, we have seen how you can ride group captured them and by using the back references. How you can use the previous data lies inside your crew as the group capturing is default. So sometimes when you are not going to use back references, your data will be captured anyway. And this is the place where we can use non capturing grope toe, make any group, nor to capture any data. Then we are not using it. So there are many advantages off non capturing groups. First of all, it increased the speed off your regular expression by because when you write your regular expression and you capture some data, then the regular expression engines saved that data in case if you use back references, so saving their data decrees your speed. So in case if your don't capture your group, then the engine is going to maximize their speed decks. Why? It's very helpful to use non capturing groups. The next advantages by non captain gropes it make a room toe capture necessity groups. So in one regular expression, you can have four Necessity group Toby captured or three, a necessity group, not to be captured toe have more space for your other group to get captured. So the notation off known Captain group is in meta character. And that is a question Mark Colon. No. Maybe you're thinking there. Why carcinoma question Mark was over 25 and we also use a question mark toe make our quantified Lizzie. But now we are still using it in our non captain group eggs. Well, it's because question mark means give this group are different meaning. And then by placing Kahlan, we are saying that and that meaning is non capturing group. So as a whole, it means that give this group are different meaning and that meaning will be known capturing group Now as per sport goes more struggle expression engines except non captain grope except for old UNIX tools. Now, let's see couple of example off non capturing group. For example, if you have a regular expression, a be captured in growth and then you have a new group off CD and you don't want to capture the debt off CD that you can simply put question mark and then call it and then you have backslash one. So this number, expression will match this testing off a B from the first group CD from the second group and then a B from the back reference off the first group. But this one vote match with a B from the first group CD from the second group backslash Woman from the data off first captured group and CD from the second group by because we're not capturing the dirt off city and we cannot use it at all city. Similarly, if we have a regular expression off, read non capturing grope looks vied, capturing group to me and we put back slash one right after our second group wide. So this backslash one represent white second group nor the first group off red because first group is non capturing group. So the testing will be fail if it is red looks white. And if we repeated red again to me so it gonna unmarried the testing this one will only match with the testing off red from the first group looks vied from the second growth than back reference off right back slash one wide and then to me, no less to run these known capturing groups Examples. So our first example Waas a bee in one group. Then we have the group off CD and then back slash one. No, this one will match dusting off a B C D and then a B again. So if I add one more time back slash tool so this one will match CD as well. So if I remove this back, slash to and make this second group CD to be known catching by adding question mark and colon So this one will only match with a B C D A b No, If I add backslash tool here, you can see that this one is not matching because back slash to represent the second group . And we made this second group to be uncultured one. That's why I got together now. If I remove this colon and question mark rotation off non captain group we found a much No , let's try the other example out and that waas in the non capturing group we had read, then we have looks then we have next group off white than we have me So this one will match Red looks vital. Vital me if we are the back reference here back slash one. We found a match. Although this was our first group. But this is known capturing group. So this backslash one belonged to this right Northey treatment. So if I adhere, red looks vied back to me. We're not finding any match. Why? Because backslash one represent white nor did it want so must use known capturing growth. And you don't want to capture data. And you don't want to back reference that group so that you can make your regular expression toe work, Foster. 33. Lecture 32 Look Around Assertions: in this chapter, we will see. Look around assertions, look around assertions. Have two types. Look ahead a session and look behind assertions. These assertions are zero length assertions. Just like the start and end off line and start and end off, word anchors explained earlier in the scores. The difference is that look around actually matches collectors but then gives off the match , returning on Lee the result match or no match. That is why they're called assertions. They do not consume characters in the strings, but only assert whether a match is possible or not. Look around. Assertions allows you to create regular expressions that are impossible to create with autumn. Or that I would get very long winding without them. No. First look ahead a session. Have to dive positive. Look ahead, assertion and negative look ahead Assertion. And also look behind a session. Has two dives as well. Positive look behind assertions and negative look behind a sessions. Now First we are going to focus on look ahead assertions and we will see positive. Look ahead a session. So first we are going toe see? Look ahead a sessions. Now, In the next lecture, we will see positive. Look ahead. Assertions 34. Lecture 33 Positive Look Ahead Assertions: no. First, let's see positive. Look ahead. Assertions. If you want to match something followed by something else, you will use positive. Look ahead. Assertions. These assertions has zero length and degradation in meta. Character airs. Question mark and then equal sign. So this question mark means give next are different meaning and our next is equal sign and equal sign. Meaning is positive. Look ahead a session. So if you see question mark equal, it will be positive. Look ahead assertions now as first board goes off. Look, I had a sessions. They are sport and most regular expression engines except for some UNIX tools. No, let's see couple off example off. Look ahead assertions. For example, If you have a regular expression long and you put island inside grope starting with positive, look ahead assertion. Then it will match testing off Long Island. But it won't match with long drive. So here positive assertion is island that will mash vidi testing if it comes with long. Otherwise long drive is not a match. Long Beach is not a match, and you can also did I write positive. Look ahead a session, something like this. Both these regular expression are the same. You can put first inside one group Long Island. And then you can say that. See if you can find the long in the text in the assertion off Long Island, so it will marriage the same testing off Long Island. It won't match with long Drive and also warned Match with Long Beach. No, let's try this one out. No, starting with very simple example. For example, if you have a regular expression A than inside group, you have positive. Look ahead assertion, and you have being here. And in the testing it will match a that come before B. It's not matching be its matching A and just A if it's going to be before B, and if I add one more time be here, it's still matching due to global more. If I turn off the global moored and if I had to be here, you can see that we are still matching a because our assertion only concern when a come before be it don't give any damn after anything. If I add something before a right here, like boot. No, you can still see that it masked a by because we made over session to look ahead. If you find be after a, then you should highlight it. There's why is highlighted here. Now let's turn on global mode again. Now I'm gonna try some other example and that will be long and I learned will be here. So this one will match long I learned. And he's gonna match only long if it come before I learned it won't match long from Long Beach. It won't match long from long drive, so it will only highlight long if it come before I learned. And now if I ard here between island and long or you can see that we're not matching anything Now let's try the adult notation here and that is you can put all Long Island here in the assertion and then you can made it for long or island. I can make it toe long. So now you can see that we are getting the same reserve here. So positive. Look, I heard a sessions use when you want to match something followed by something else. Now, in the next lecture, we will see a couple off difficult example off positive. Look ahead Assertions 35. Lecture 34 Positive Look Ahead Assertions Example: No, Let's try some other examples off. Positive. Look ahead. Assertions. So, in the testing, I'm gonna based one paragraph that contains some information. And no, I'm gonna create here a regular expression that will match the ending word off our each sentence. So, in order to create the regular expression So first I'm gonna have on word boundary that will be followed by A to Z and capital A to Z, and that's repeated couple off time. And then we are going to have the ending word boundary there. So as we are going to create a regular expression that will give us the ending word off each sentence so you can use directly the daughter by escaping it, it will also give you the ending word off your east. Intense. So now you can see that this one is highlighting the whole word, including the dart. So, as we are going toe year did regular expression that will give us the ending bird off each sentence, but not including the dot. So we can do that by using the positive look ahead assertion. So I'm gonna air deposed you. Look, I had a session, and I'm gonna say that it should be dart. So it means that Look ahead. If you find dog, then give me divert. That is before the door. So we also have to skate, distort as well. So you can see that we're getting the last word off. E sentence, Not including dart. So using posted. Look ahead. A session is quite cord, right? Because we are using the ah hurting toe. Find something, no other strive on more example out. So instead of finding dot word, we can find some word that has the comma right after the word. Now you can see that we found this word film that has the coma. After that, we don't need this back slash share anymore. And also, this office has the coma here. This internationally has Tacoma office has jicama. We found 1234 and five match, including this ended in this testing Knoller's concise eyes over search more. And you can do that by using couple off more assertions. So now I'm gonna find all these words which has a coma, and ah, they have office in the so right after this board boundary, I'm gonna add one more a social here to be positive, one in which I'm gonna repeat word characters repeating it with 20 fire off aesthetic followed by CE. Now you can see that we phone only to match. So what we said here we said a to Z or capital A to Z inside when word boundary that has the coma ahead And then we are did one more assertion before a to Z or capital A to Z But inside the ward boundary And in this assertion we started that there could be any word corrector but the ending off the world character must be See there's why you can see that we found too much No, you can concise eyes, the search more You can heard one more assertion and you can say that that bird in your A to Z must have capital. Now you can see that we just selected this office because this office text has capital So you can add many assertions here and make your search more solar 36. Lecture 35 Positive Look Ahead Assertions Example: so by this example that we've seen in the last video reconciling our search more. First we went for the coma. You know what it does your capital. It was a string. Then we added one more assumption that our word ending word that has come after it must contain CE. And then we made it mawr solid by making it that it should have capital. They're so you can see that this office is highlighted. But this one is not knowing this lecture. We're going to try some more examples in which you can use the more than one positive local her decision. So I'm gonna add a couple off test strings here. So, in the testing, I'm going a couple of phone numbers off us for Mitt. Now, you can see that I added three phone numbers here. So first I'm gonna create one regular expression for them. And that will be, of course, back slash d exactly three times. Then dash, then backslash de again exactly three times dash backslash t exactly four times. And we phone a match. No, this was our simple regular expression for the phone number. No, let's air a couple of more restriction by using the positive look, I had a session. So I'm gonna add here one look ahead assertion. And I'm gonna say that from the start to the end this phone number, this phone number must have 0 to 6 range. This woman must be in between 0 to 6 range and it should have the dash inside the phone number. And we also have toe back slash dash inside Erector set. Unless it appeared this couple of times. So as we're using the starting and ending anchors so we must have toe on the multi line more here. Now you can see that we found only too much is because we said here in this positive assertion from the start from the carrot. So the end off our regular expression, these digits must have 0 to 6 or dash. And you can see that the first phone number has seven. That's why this one is fortified. The nest to one has the digit in between 06 No, if I change this 1st 17 Toby four, you can see this one is also matching. So we made the cessation toe work from start to win. No, in case if you want. Where even more. So Shin. For example, if you can say that our full number must have three toe one digit at any place. So you can heard this new assertion here. I'm gonna say that my phone number can have anything in it by using the viral card, but it should have digit off 3 to 1 at any place. Now you can see that we are only matching this phone number if I have one more phone number here went toe three, 456 for 214 This one is not matching. But if I add the same number, But with the 3 to 1, the section that we just are did. Now you can see that this one is matching. So by adding couple off more assertion, you can make your regular expression Toby Mawr Strick while dealing with their strings 37. Lecture 36 Negetive Look Ahead Assertions with Example: in this movie, we'll see. Negative. Look ahead. Assertion. These a sessions are opposite toe positive. Look ahead a session. So if you want to match something not followed by something else, you will use negative Look ahead. Assertions And these sessions are also zero vert and then rotation in mattock directories. Question mark and exclamation mark, or you can call it north symbol. So this question mark means give next are different meaning and that exclamation mark have the meaning off. Negative. Look, I had a session. No, let's try some examples off. Negative. Look ahead A sessions, for example. If you have a regular expression off long and if you add negative, Look ahead. Assertion off. I learned inside what grope starting with a question mark. North symbol. Negative. Look at her decision. So as compared to the positive look of her decisions, the result will be opposite. This one won't match with Long Island, but this one will match other than Long Island, it will match long drive and also Long Beach. No, you can also dire this regular expression like this. These two regular expressions are the same. This one won't match with Long Island, but it will match Long drive and Long Beach No other stride these examples off. So first seeing the invitation off long and inside our group I'm gonna make it negative. Local her decision. I'm gonna add the island here so this one won't match with long with the island. But it will definitely match with long if it come bid drive and ah, it can also match with long. If it come it beach So negative. Look at her decision. If you want to match something not followed by something else So there's something else is island now if I change this negative Look, I had a session with positive. The desert will be opposite, See? And also you can make it to the delimitation. You can put the whole world which you don't want to match and you can put long at the end So it will match with the long drive a long beach, but won't with Long Island? No. The other example that we have seen in our positive local hurdle sections know their stride with negative located assertion. So I'm gonna already testing here the same dusting that we have seen before. No looks Good year did regular expression for this so word boundary Inside, we can have a to Z and capital A to Z repeating a couple of times No, adding the first positive look ahead decision that we have seen So you can see that we only highlighted this films and Italy. And in case if you don't want toe highlight thes one, you can add the negative Look ahead decision the desert will be other than dot erred in We are not matching thes one anymore. Similarly, you can make this Toby give everything that do not have coma at the end off the world body were not highlighting office films internationally and office and also these 101 50 because there are 0 to 9 Ridge You can also combine your positive look ahead a session with negative look at a session. So for disco my I'm gonna make it the the positive Look ahead a session. Now you can see that we're matching office internationally films and office, The deep, positive local her decision now seem like before I'm gonna add one more recession here and I'm gonna say that this a session should have word characters repeating a couple of time, but it should have CE Now you can see that we highlighted two words. No, I can add one more assertion here and dollars first. Make this assertion, Toby. Positive one. The same one that we have seen. So it could have the word corrector repeating a couple of time and it should have capital. Now you can see that we only highlighted this office. No, in case if you don't want toe, highlight the office that have capital. Oh, you can make this a session to be negative. So if I am make this one to be negative. But you can see that this one is not highlighting anymore. And we have highlighted this one. So in this regular expression, we got to positive Look ahead decision and one negative. Look, I had a session. 38. Lecture 37 Look Behind Assertions: in the previous movies we have focused on Look ahead assertions in this lecture. We are going to see the other type off, look around recession and that is, look behind assertions. Look behind assertions. Are the assertions off What could possible Toby behind? They are similar toe look ahead assertion. But in look behind we see behind not ah head. And if look behind a session fails, the whole match is gonna fill, and they are also zero vit assertions. Look behind a section has to type positive, look behind assertions and negative look behind a social. And in the meta characters, the represent positive look behind assertion with question mark angle, bracket. Or you can call less than symbol and equal for positive. Look behind assertion. And for the negative look behind a social. You have question mark angle bracket and did not symbol. So the positive look behind assertion means if you want to match something, proceed by something girls you really use positive. Look behind assertions, and if you want to match something not precede by something else, you will use negative look behind assertions. Now, as for their sport, goes, look behind, such as are not Vitaly sported their only sported in .net fight on PHP. Ruby 1.9 and higher versions. Bull Angela. They're not supported in Gela script, and Junik stools and look behind sessions are not widely used. Now let's try some easy examples off. Look behind assertions. So here, I'm gonna create regular expression that will have the look behind assertions. So first question mark than angle bracket and then equal sign and I'm gonna put here a and this one will be look behind assertion. So this one will match the A. B. Because we got a behind be. There's why beats highlighted. This one will match the word cab and be will be highlighted because we got a and then B but this one won't match with bed because there is nothing before being here. But this one will match tab because we got a behind be theirs by bees highlighted. But this one won't highlight that because we got E before being. If I change you to a B is highlighted. No, let's try negative look behind assertion. So all we have to do we have to remove this equal and we have to put not here So now you can see that it will highlight those bees where we are not having it. This one will highlight bed be and also the duck because it has not a before B if I change it again in tow. Positive load behind assertion. The reserves are completely changed. If I change into negative look behind the session. The desert are different. No. So it means that you use negative look behind assertion when you want to match something, not proceed by something else. So here be is not proceed by a know if we have some word like long and I learned Toby here . So the testing will be long. I learned. See? This one is not highlighted Now if I change in tow positive. Look behind Assertion Island is highlighted. If I had her long drive or primary focus is with the island, not with the long because we are seeing the look behind the session. So if I have here Dr Island, you can see that this one is not highlighted either by because there should be long before I learned. Now if I change this positive look behind the section into negative look behind the section . You can see that this one is highlighted. This island is highlighted. Why? Because I said here the island should not proceed by law. And here you can see that regard something other than long in the third test ring. That's why this one is highlighted. Knoller's trying one more example here. So I'm gonna air the same testing here that we got a Lear sweating the testing here. So for the rebel expression, starting with divert boundary. After that, we could have or corrector repeating a couple off time, then word boundary again. So, no, let's add one assertion here. So after the world corrected, I'm gonna say her My assertion will be positive. Look behind assertion and that a session must have, as at the end, off over word border. And I can see that we highlighted all the text that has the ending letter off s films has the S r. Than is also has the end s No, If I am made this positive look behind assertion Toby, Negative on. Now you can see that we are highlighting those words which don't have the ending word boundary off as so if we compare, Look ahead assertion that look behind assertions. We can do everything off. Look behind with, look ahead, assertion. But most people used look ahead a session VAY because there are supported in many of the regular expression engines. 39. Lecture 38 Unicodes: in the early ages off computer sciences, scientists used bit to store data and but can only store that are off by Ndri. It could be on off, or you can call one and zero form. So with the passage of time, the bit unit has been changed into bite That can store eight bits and you can kill cleared the data. How much data the bite can store by to power it so it can store to 56 characters at that time that also include a to Z Capital law and 0 to 9 numbers along with symbols. Then we came of a different data unit off double byte that could store 16 bears, 65,536 characters. It was quite enough as for us, Roman L. Farber's was concerned. But we have a lot off other collectors to store, including languages like all the alphabets off Arabic, Chinese, Persian or doing Hindi. So as combined, we need a system, some data unit that could store 1 9000 collectors because these languages have different alphabets. That's why we came up with the idea off unique core system. Actually, Unicord is the variable bite size. You can have one bite you can have to buy, or you can have three Myers up to your choice and it allows you to store one million characters enough for our current of data need. So we should be familiar with the concept off Unicord via working with the local expression in case if we have to work with some files other than Roman alphabets. So Unicord represent by U Plus followed by four digit hags are decimal hex. Our decimal means 0 to 9 and a tow f notation that we use in our colors notation off CSS and also we use them in a steamer Special characters No. For example, if you have ah, string off Belle that contained the E with accent, it's nor the simple e from the Roman L. Faubert. So this E has the value off you plus 0 +11 b U plus represent unicord and for did regular expression. This e has backslash you zero double von be value. So we represent you. Plus in normal regular expression by backslash you some regular expression using notation off back slash x in start off backslash you dollars. See this in drug or expression. First, regard the testing off bell with the accent e silver regular expression will become be as a character. Then we will represent even the accent as backslash you zero double one B and then double l air. The end represent simple collectors. So this regular expression will match pestering off Bell with the accent e. But it won't match with Bell without any excellent. Or you can say Bell did Roman l phobics. No, let's try this example of now here in my rejects 11 dot com. I'm gonna change the flavor for now because we have selected and we have worked proud in the scores with the p C R E ph B engine flavor pcrm mean pull compatible regular expressions? No, for using the Unicord, I'm gonna select the engine off Gela script. No, let's run the example that we have seen. So, for example, will be B e double l that will match Bell, but it won't go in a match with bell vidi, accent E. But because this e represent the unicord. So if you want to match this bell with the accent e, you have to put a dent imitation So first putting back slash you'd than zero double one be capital bees. The unicorn off this e No, you can see that we matched this bell with the accent E but nor the simple bell in the Roman L for birds. So whenever you have tow deal with characters other than Roman alphabets, you should know their unique oars before trying them out. But as we mostly worked with Roman and forbears, so you're not gonna use Unicord more often now, as per their sport goes there only sporting in Java, JavaScript .net fight on and Ruby fit backslash you syntax and in bulk and ph being we use backslash X instead off backslash you and there aren't nor sported in or UNIX tools. 40. Lecture 39 Names: Now we are moving the word, the completion off the scores by making some very useful regular expressions. But before proceeding any further, I want to clarify something. It's possible the regular expression that we are going to make in this chapter could be different than yours. It's possible that my regular expressions could be very easy, but powerful. And also, if you practice them and you adopt some kind off your larger, it's possible that your regular expression could be very easy, but more powerful than mine. It's all about using the logic so you're logic could be different than mine and D working and the power off. Different regular expression could be different, so you can create your regular expression by using your own logic. I will stick with mine now before wasting any time. Let's create our first regular expressions. So the first ago expression that we are going to create will be for matching name, and you know that name should include lower A to Z and capital. It was the year for birds. It must. We start with a capital A to Z, and there should be no numbers and any kind off symbols in the names. However, you can use dark spaces coma inside your names. So let's create regular expression for name so that you can see power is going to be bird. So first, let's add our starting and ending anchors here that will represent the start and end position. So as a told you, that name should start from the Capital Alphabet's. So I'm gonna add one character said here that will include the corrector. Ranges off a to Z now. Right after that, I can add one more corrector set for the rest off the information. So the next characters that will include lower it was the ranges or the capital one also depend on the user, and I'm going to repeat it by using the plus notation. So if I are some name here, Josie, I have used these anchors for starting and ending, so I have to turn on the multi line moored. You can see that testing has not matched its because D. J is lower oven and I specify here the first alphabet must be from the capital for bursa looks at Capital G here. Now you can see that we found a match If I had her space and a gram. Now you're seeing that we are having some problem because I have heard one space here. So in this character set, I'm going to specify space here as well. Now you can see that we found a match. So in case if someone has name off Husi John Nash, this one is also a match. And some people have names like doctor. And after the ad, the are they are dark jaws ib so you can see that this one is not matching because we used the daughter. So in the correct arranges I'm gonna add dot here regard this match. Some people also prefer coma inside their names. So I'm gonna add the comma here so the use come out to different share their first and last name. So I can are the comma here as well? No One thing to notice her. I used the alphabets lower and a proven I didn't use the interpretation off back slash w because if I cut this from here and air back slash w the W's going to law the names which have the digit as well. For example, it could the law, Joseph four And it's not a valid name. Tohave digits. That's why I used the other notation off Roberts, nor D word corrector. Anyways, here is one more useful technique, and you can see that we can take as many alphabets from disk Rector set. For example, if someone could have a name off John Hogg Nash and so on, if I copied couple of time Now you can see that this one is quite a long name. So you can restrict the number off directors by adding the limitations here. So I'm gonna add the calibrates is and I'm gonna make this cracked. Is that Toby within the two Goemon 30. So the lower limit off name could be, too. And the upper one is the 30. We can take one from here, and we should include at least two room here and now we don't need this plus symbol here anymore. So this will match J A. Because we are taking one the first director from here. And then we are taking two characters. At least two directors from this character certain so our minimum length off our name should be three. So the regular expression for our name is completed, But one last thing I want to show you here is that if someone has a name off Emily, look us instead, off adding one space here. He can also add more Denman space. For example, I can add many spaces here. I want this name does not make any kind off sense here. So I'm gonna add one assertion right before our name that will check whether we add more than one space or not. So I'm gonna define here one assertion right here and that a session will be negative. Look ahead. Assertion. Because we will not allow those name that will have more than one consecutive spaces. I'm talking about consecutive spaces, so I'm gonna add negative. Look, I had a session here. So in this recession, I'm gonna say that there should not be two consecutive spaces in my name. So first, I need to define the viol card and repeated couple of time. And then I'm gonna say that there should not be two consecutive spaces in my name, so I can add The space is hereby back slash s and I'm talking about conductor spaces. I'm gonna add one more time back slashes So now you can see that this Emily is not matching any more hair? No. If I adhere of a name off John Space Steam, you can see that reform. Imagine if I had one more space here. You can see that this one is not matching anymore. So if I remove this place from here and if I add one more word here like John Steve Russo, you can see that this one is still matching. And if I can add one more space here, you can see that it's not matching anymore. Similarly, we can also add one negative. Look ahead, a session that will make sure that our for name should not have two consecutive dot and two consecutive commas. So I'm gonna copy this negative look at that session and right after it, I'm gonna pieced it one more time, and now I'm gonna add it for $2. And of course, we have to escape these dot here as well. So if I have a name off Dr $2 a gram, you can see that this one is not matching anymore. If I remove the start, we found a match. No, Similarly, for the coma as well. So not pasting it for the comma. If I had one name here, Toby, Emily, through commas. Look us. You can see that we are not finding any match anymore. And if I are two spaces here, this one is also not meeting. So you can make your regular expression for name as much complex as you want. Or you can just leave this adult. Any assertion. It's completely up to you. As I told you at the beginning, off this lecture, it's completely up to you how you want your regular expression to proceed. 41. Lecture 40 Email: in this lecture, we will create drug your expression for email. You can add laurel for Burton capital for birds in your email. But your email should have are there? It's simple. You can also our numbers and symbols inside your email. No, let's create regular expression for over emails. So first, I'm gonna add here our starting and ending anchor to match line. And also, we need to turn on multi line mode here as well. No, here. I'm gonna piece when testing off simple email. So first, we're going to match this simple email here. You can see that we got word corrector hair and I told you there were character can have alphabets and numbers and order score sign so we can heard backslash w here, and we can repeat it couple of times after that, you can see regard the air, their symbols. I'm gonna air directly under your symbol. Then you can see we got example again. So I'm gonna air divert collected again. And after that, you can see regard DPD in here, So I'm gonna add the dot and of course, we have toe escape this start as well. And also this word tractor. We need to repeat it couple of time by using the quantify. So I'm gonna use the plus quantified here. Now, after this pdf, you can see that we got again this tax. So I'm gonna add word corrector again and repeated couple of time. Now you can see that we found a mass that match this email. No. Before moving any further, I want to clarify month in here. You can see that this is the domain part dot com dot us dot UK and daughter au. So in, start off adding word corrector. If you can add dot com dot us here, it could be more appropriate. So if I remove this work director from here and add one group here and if I had come, you can see that we found a match. But what if some email have some other domain name other than come? For example, if some email could have instead off dot com, it could have dot net. This image is also a valid email. So you can add alternation here and you can add the next hair as well. You can add a couple of other thing here as well, Like us or UK, but we have many domain name right now. In 2017. If I can show you real quick, the domains hair on Wikipedia side, you can see we got many domain name like dark GM dart G Q. And many demean. You can find her like dot brokered dot build dot builders door business, so we cannot add all these demand here inside one group. It's not a good idea to wear determined, so I think it would be more great if you leave this so the alphabets or the world character and you can limit their sizes because the 25 plus means you can have the one or many things out off this group. So I'm going to remove all this group and in start off making it to work. Actually, you can also make it word character, but I'm gonna make it to the alphabets for the domain, and I'm going to define her range. So no, it can match with dot business. And, ah, if I are a couple of Morris's, you can see that this one is not very appropriate, so you can limit the domain content here by adding the limitation instead off quantify. So I'm gonna limit this one. Toby, have to go. 15 word characters from this ranges off a to Z and capital A to Z. So if I have this, you can see that we found a match. Now we dedicate one problem off the main. No, let's move to the other part. And that is you can see that we got work. Character were character means you can add the alphabets and the numbers, but you cannot air the symbols like hash or dollar. So instead of using the word corrector just fever character, it would be more appropriate and valid if you use other symbol here as well. So I'm gonna put this word corrector inside, one character said, and I'm gonna air the other symbol from a keyboard that are valid for the email. So at this dog, I can also are the hash and dollar and personally signed all the symbols that are valid for the mail. No. Insert off typing all these symbols. I'm gonna paste devalued symbol here, so I'm gonna baste it by control V. Now you can see that I have added many symbols hash north dollar percentage and single court hysteric plus forward slash. And also we have to escape this forward slash and also this range their symbol. Now you can see that this email is completely well it. If I had one email like her to be example underscore 56 dash 90 Add the rate off gmail dot com You can see that this email is also well, it So now we completed one part, but still you can see that we can heard many things in the first area we can add as many s we want. So it's a good idea to limit this 20 fire this plus one as well, like we did with this one. So I'm gonna make this character set to repeat it from the range off one toe 35 times. Now you can see that the similarly is not valid any more. If I remove a couple of these things, this one is valid. So at certain after crossing 35 this email won't be valid now for this word director right after the air symbol. Now we have to focus here because we have some emails like example. Are there it off? Example dot com dot us. Now you can see that this email is not valid anymore according to the soccer expression by because we are using dot twice here and we made of regular expression to use only one dot after the air symbol. So I'm gonna put this word corrector inside when collector said in which I'm gonna a lower dot here. Now, you can see that this one is valid and you can also remove this plus 25 from here. And you can add the limited quantify like I did hear from 1 to 35 or 2 to 15 you can add it here. So I'm gonna leave this country fire to you if you want to change it Now. The last thing for this world character, it's possible that in start off having the dot after the act symbol, it could also have the die. So I'm gonna add the dash here. And of course, we need to escape this time share as well. So this one, we'll also match with the dash here. Now, our regular expression for the mail has been completed, So I'm going to add a couple off test strings here and all these emails are completely valid, according to the Wikipedia. So for the first email, you can have von Digit, and then you can have the other is symbol. This is also the valid email this pretty and simple. Our third of example dot com is also valid, and it's matching with a record expression. This very dark commoner threat of example dot com is also valid and matching with her expression. This email this possible door style dot email dot with plus symbol address resemble dot com is also weathered. This email with dashes also Wellard This email fully qualified is also valued. This email example are the write off as door solutions is also valid and completely matching with Allegra Expression This email best Erdrich best dot com is also valid. This email with the symbols and dinner Great and example daughter orgies also Well, it and the last emir dot com dot au is also well it now I have copied all these emails from the Wikipedia side. These emails are completely valid. No, I'm going to paste couple off invalid email so that we can know that rather, a regular expression is going to match with the invalid format or not. So now, after adding one more line, I'm gonna add invalid email like me are the invalid here. These all emails are invalid. The 1st 1 is invalid because we guard the daughter. Earth, Wind. We cannot air the door, Arden. It's unveil it. That's why this email is feared, and other regular expression is completely valid for this email. If we remove this dot C, any of this, the next email, you can see that this one, God, very long length hair. So if we remove couple off length from here, you can see that this one is also valid. So a regular expression is completely valid for this invalid. Email. No, for this email john dot dot doyou or the rate of example dot com. You can see that this email is still valid with a regular expression. It's because you cannot add double dot consecutive two dot inside your email. It's not valid wear to dot consecutive daughter in your email, so I'm gonna add one assertion here, and the assertion that I'm going to use will be, look ahead, negative a session because we are going to make our email not valid if it have two consecutive doors. That's why I'm going to use the negative look ahead assertion nor the positive on because we don't want two doors. So I'm gonna add one a surgeon right at the beginning, and I'm gonna make it negative. Look ahead and I'm gonna say that at anywhere in my regular expression, my email should not have two consecutive doors, so we need to escape these daughter as well. Now you can see that this is not matching with over regular expression anymore. Because this is the invalid seem like this. You can see that regard to constructive dot before the gum and ah, by adding this simple negative look at that session, it also falsified this email to match with over regular expression. Now, for the last one, you can see that regard three time at the rear symbol and we can only have one air dotted symbol in our emails. That is why this one is also invalid. Even if I remove these aired a rate, you can see that we found a match. So anyways, this is the regular expression for the email that we have made in the next lecture. We are going to create ah, regular expression for matching the website You RL's 42. Lecture 41 URLs: No. In this lecture, we are going to create the regular expression for matching website anywhere else. And there is only one rule for Urals, and that is it must be valued Euro. So let's create regular expression for this. No, Before starting, I'm gonna put in detail, string, diagnose some valid anywhere else. So I'm gonna pay some you elf here. These all yours are completely valid. You can see that these one God underscore sign and some mural. God. Question Mark and the other symbol. Hair as well. Like and and person Tate and forward slashes and backsplashes. And also the colon here. So you can add any type of symbol in your Yura. But one thing in common in all these Europe and that is this starting part. Some Ural have http colon to forward slashes where some mural have as to t. P s colon to forward slashes. And in case, if you are working with FTP server, some mural could have the ftp colon to forward slashes example dot com This Ural is also valid. So first we need toe focus on the starting part off this http or https or the ftp part. So first, I'm gonna add starting an ending and car to match line. And we also have put on on the murky line moored so as we have only three more https, https and FTP. So I'm gonna define one group here in which I'm gonna say that it could be as DTP or by using the ordination symbol. It could be as TTP s or it could be FTP. And after that you can see that regarded Colin here. And Colon is necessity in over every single Europe and also the two forward slashes. So I'm gonna add colon here. After that, I'm going to add toe forward slashes here as you can see that regard the patron er, because you cannot use your forward slashes directly in your regular expression until you escape them with bath slash. So I'm gonna aired back slash to escape this forward flash and also this forward slash as well. No. After that, you can see that regard text and it's also possible that some mural could have e x a 56 This is also valid. So I'm gonna add one characters at here that will allow my website toe have lower a to Z and also the capital A to Z and also the 0 to 9 range. And also it's possible that our website could have something like full underscore food dot com. This is also valuable. So I'm gonna air the other symbols here as well, because you cannot add all the symbols inside your website address. So inside this characters that I'm gonna add all the possible symbols that are valid for the website. Ural, I'm gonna piece them here. No, you can see that regard this dash, so we need to escape this dash. And also we need to escape this forward slash it as well. And also, we need to escape this ending corrector set as well. No, we completed this character said that include lower to Z capital A to Z and 0 to 9 and all these symbols. Now we can repeat this by using the plus quantify. No, this regular expression is complete. Now you can see that it's matching all thes Urals and also these Ural that we used for our local server like 1 $42.42.1 dot one. This is also valid. Well, but lastly, here is one problem. Because in case if I have some your alike http Colon go forward slashes and just the X You can see that this regular expression has matched this euro. And this Ural is not valid by because you don't have the domain name means it don't have the part that come after the dark. So we need to make sure that at least we should have one dot in our juoro so that we can have the domain name after dad dog. So right. And then before the ending anchor, I'm gonna add the daughter, and we also have to escape this door. Now you can see that this one is not matching anymore. It's because after dark, you can see that regard Couple of things like dot com slash blunder score block or here you can see that we got dot org four slash wiki list off something. And also you can see that regard blonde or score blah. Question mark mean the search Pretty perimeter. So now we need to define this part. This part is working for this 1st 1 Then we got this dot Represent by this start here and know many toe define again this part. So instead of defining it again, I'm gonna copy this whole character set and I'm going toe paste it right off the hour period. I see. No, you can see that we're matching all these regular expression, but not this as to t p colon to forward slashes X animal. Why? Because it does not have any dot And if it has dot it don't have anything after the dog. You don't have any kind off domain name after the door, so it must have something after the dot so that it could be valid, for example, it could have extort us. Now you can see that this one is matching. No, this is our regular expression, for you are No. Before ending this lecture, you can see that we use this group here in which we put as 30 PST, GPS and FTP, and we're capturing this group. So I told you in our growth chapter that when you are not going toe reuse your capture group, you should not make it to be captured one. So I'm gonna make this group, Toby un captured group by adding question mark and colon. Now you can see that this group is non capturing group that will maximize the working off our engine when it's going to match with this regular expression and still you can see that we are matching all these euros without any problem, So this is our regular expression for euros. 43. Lecture 42 IP Addresses: I have a confession to make, and that is for creating regular expression for I p address. Well, some people find creating regular expression for numbers and I p address very difficult. But I think that creating regular expression for numbers and I p address is Lord more simpler than creating any other regular expression. And I hope after this lecture you will find the I B address. Regular expression. Ah, hell, easy. So let's create our regular expression for I p address. First, we have to limits in our I p address for the lower limit. Our I P address could be 0.0 point zero points, you know, four Zito's separated by dot and for the higher limit, we have to $55 to $55 to $55 to 55. So all these numbers from 0 to 2 55 are completely valid for the I P address. Now, here are a couple off valid I P addresses. For example, you can have I p address like this. 0.0 dot $01. 00 It lies within the range off our lower limit and higher limit. It's valid. You can also have some I p addresses like this couple zero dark triple zero dot triple zero dark triple zero. It's also valid because it lies in our limit off Lord and higher. You can have address off 1.1 point 1.1. He is also valid. You can have 1 99.54 point 2.123 And it's also lies inside your limits. Off pipe eras. You can have this I p address to 54 because to 55 is the higher limits. So you can have 2 54 here you can have after that 101 99 then dart and then 30 Or you can have I p address off $005. 6.199 dot 016 Now, these are all valid I p addresses. Now for the invalid. I p addresses any I p address there does not lie in the limit is invalid. I p address. For example, if you have ah i P address off to 56.255 dot 255.255 We don't have a problem with the last three portion, but 41st portion, it's 2 56 So this I p address exceeded the higher limit. If you have i p off something that exceed the all the four places from to 55 years off invalid. If you have i p address, that is right at the beginning, like 011 But then it has the to 99 exceeded the limit off to 55. It's also invalid i p address. So make sure when you are creating your I P addresses, it must lie within the lower limit off 0.0 point 0.0 and the high limit off to $55 to $55 to $55 to 55 or excoriate our regular expression for I P addresses now in the festering. I'm gonna put all the village I P addresses here and now let's create about agro expression . First, I'm gonna air the starting and ending anchors right here. And you can also see that I have turned on already this mortal unmoored. You can see that we got four did years separated by dots and the hair you can see we got one digit here you can see regard two digit and here you can see regard three digit. So where did it could being from 1 to 3. So I'm gonna add when Digit here, and I'm gonna make it toe. It could be even toe three the year. And after that you can see that regard the dark. So I'm gonna air dart and we also have to escape the start and all. I'm just simply going toe Copy this because we have to repeat it four times and I'm gonna pay state four times here and no removing the ending dot from here. Now you can see that we found a match and all these I P addresses were completely valid. Now, in case if I add some invalid I p address like to 56 door to $56 to 56 door to 56 you can also see that this regular expression is matching this I p address here as well. Although this I p address is not valid, it's exceeding our higher limits. So instead off using this direct notation off digit and make it toe oneto three time we have to come up with another solution and we have to define ranges by ourselves so that we can have our I P address within 0 to 55 range. And also this one is matching with I P address off 1 90 nines or 01 dot to 86.0. This one is matching with this one, although 26 is exceeding the higher limit. So we need to break down our valid limits for I p address. So let's do that. So for creating regular expression for I p address, we need to break down our lower to higher limit in characters so that our I be address must lie within the limits off 0 to 55. So the first character said that I'm gonna break will be 2 52 to 55 for matching number from 2 52 to 55. I can do that by putting 25 outside off the collector set an inside characters that I can put 05 range that will match all the number from 2 52 to 55. It will match 2 15 to 51 52 53 2 54 and 2 45 now for the next Vivian for our I P address. Our next range will be from 200 to 2 49 and you can make this happen in your character set by putting two from 0 to 4 character set and zero tonight. So this one will match all the numbers from 200 to 2 49 No, for example, if you have to match the number off to 36 now, you can take to from the first and then you can take three from the first character set off 0 to 4 and 46. You can take six from your second character set that is starting from zero toe nine range. Now for the next Davian, it will be from 101 99 so for creating regular expression for it, it will be from one and then 0 to 9 character set and 0 to 9 collector set one more time. So, for example, if you have to match 1 50 year, you can take one from the one and five from the first character set and eight from the second, Corrector said. Now, for the last limit, it will be from Triple zero total 099 and it will be zero and 0 to 9 character set and 0 to 9, Character said. For example, if you have to match 0 77 you can take zero from the zero part and seven from the first character set and seven from the second collector set. So this last one will match detest ring off triple zero. But it won't match with double zero because you have to take wanting from each these part. And also this last range off triple 0 to 0 or 99 won't match with single zero because you can take at least and maximum three characters from this range off 0029 range and 0 to 9 range. So you have to make something optional so that you can work with doubles you and then you have to deal with singles, you know, so you can do that by making something optional. So I'm gonna make this 1st 0 to be optional so that it could match double zero from disk. Rector said these two characters service and for the last one, I'm gonna make this one to be optional as well so that we can match this last zero from the first practice said no. These last two limits off 100 of 1 99 and people 0 to 0 99 could be must, because these two have common part. And that is 0 to 9 to, Director said. In each off these limits, so you can make them in burning character satellite. You can put zero and one inside, one director said, and make it optional and you can make this 0 to 9 to Director said. As of one character said, Now, the reason why I didn't add the question mark here in the second part, it's because I told you about the greedy and lazy approach. So if you add the question mark in the middle one right here, it will be lazy and it will try to escape something from the second character said. That's why I make this middle one this middle one greedy part and the last one, the second character said to the lazy one. So let's try them out For now. I'm gonna put all this regular expression into one text file right here, and first we are going toe create limit for our 2 15 to 50 days. So first I'm gonna create one range from 2 50 to 55. So here, I'm gonna write her first range and no less creative arrange. So for matching digit from 2 50 to 55 first, it will be to five. And then inside the character said we have to define the 0 to 5 edge, so it will match with the world. So 55 it will matter to 15. It will also match to 51. It won't matter to 56 2 49 So this first part is completely valid. So I'm gonna cut this from here. And in this file, I'm gonna port the first range and or creating our second range from digit 200 to 2 49 And now for creating over second range, I'm gonna make it. Oh, first Mrs three will be character toe. Then we can have the limit off 0 to 4. And for the next one, it could be 0 to 9. So this one will match off course to 49. It will match 200. It will match toe a four, but it won't match with 2 15 and also it won't matter. It toe 56. So this range is this second rate. So I'm gonna cut this range from here, and I'm gonna piece the strange in this text file. This is our second range. Now, for the third range, it will be from the range off 101 99. So in the regular expression, it will be like fun. And then we can have 029 range and then we can have 029 range. It will match from 101 99. It will match 100. And also it will match 1 99 But it won't. Magic 200 now, for example, if I remove this ending character said from here, it won't match here anymore. It will only match from 10 toe 19. So that's why I did this ending character set to match from exactly from 100 to 1 99 It won't match with 99. I'm gonna cut it from here. And in this I'm gonna be stirred turd range, or you can call it limit. It's completely up to you now for the last rain. It will be from triple zero toe 0 99 So our first part will be, of course, the zero. The next part could be from 0 to 9 range and the next from 0 to 9 range as well. So it will make triple 00 double line, but it won't matter. Double zero. So we have to make money characters there to be optional. So I'm gonna make this last one to be optional. Now you can see that one matching with double zero. I fire justice. You know, you can see that we're not finding this match. So we need to make this video to be optional hair as well. So this is our fourth range. So I'm gonna cut it from here and paste it here. Fourth range. So, as I told you earlier, you can combine this third and 4th 1 So let's combine them. So combining third and fourth will be putting zero and one inside. When Corrector said, this one will match all the digit from zero toe 1 99 You can see that it's matching all these digit from the range of 0 to 1 99 I'm gonna cut this from here and pieced it right here. So a regular expression for I p address has been completed. As for defining limits now we just have toe put all these things inform off alternation to make it work. So the 1st 1 will be to 55 to 0 to five. So I'm going to copy it from here. So I'm gonna say here that so it could be 2 52 to 55 then adding the ordination symbol. No putting the next limit corporate from here, basting it right here. Now, putting the next limit, you can put third and fourth, or you can pour the combination off these limits. I'm gonna party combination. So adding, first the alternation, then combination. So we're done? No. Let's put all this inside one group. Now this regular expression will match all the digit from 0 to 55. For example, if I remove all these digit from here and if I put her zero, it's matching zero. It will match 10. It will match 99. It's rematch to 55 but it won't matter to 56. And it won't match with anything other than zero toe 2 55 It will match triple zero it will match double zero. It will match double line, but it won't match triple line because it's exceeding the limit off to 55. Now, I'm gonna copy all this regular expression and first putting it in this file. And I'm gonna call this Toby range from Zito. So 55 this one right here? No. As a regular expression is something like digit than period. So, no, I'm gonna add pdf here. So first backslash than period, then I'm going toe based this expression again. And also the period because we have toe take care off all these four part we got four part . So I'm gonna pay state right here one time. So we got two times no third time and then four time and now removing the ending door. Now you can see that we have mashed all these I P addresses, and our regular expression is completely valid. No. Now you can put any valid pestering here. For example, if I put something here, Toby double 0.56 dot 2 45.0 You can see that this one is also valid. And ah, you can see that these I p addresses are not value anymore. So if we have some invalid one Toby to $55 to $55 double line 0.26. You can see that this one is not valid because it's exceeding the limit at this part. This last part that regard here. So this I p address regular expression is complete, and it's completely Wellard. Now, before ending this lecture, you can see that we have captured these group. So as I told you earlier, when you're not using the back references, you should make your captured group to be non capturing one. So I'm gonna make all these groups Toby known Capturing group and also this second group here as well this third group and also making this last group Toby non capture more. So this is our regular expression for I p address. So I'm gonna pace this regular expression for you inside this file. 44. Lecture 43 Dates: in this movie, we will create regular expression for dates. We have many formers in dirt. You can pick any other format you want. I want to pick this form it month done day and then here, separated by forward slash or dash So it will be something like It will be about a month. 24 will be over date and 2017 will be over here, separated by forward slash. Some people write numbers below 10 from one tau nine like 010203 So this is also validate like zero aid forward flags 24 forward slash totaling 70 and instead off using the forward slash you can put dash here as well. Know the first thing. First, we are going to create regular expression for the month. Then we will move through the day. Part and days are from 1 to 30 or 31 so we'll create regular expression for the day and then for the year will create four year digit regular expression. But we will create our range from certain year toe the ending range. So first, let's create regular expression for over month. So first I'm gonna add her the anchors starting and ending, and I have also turned on this murky line more so. Our month are from 1 to 12. We have 12 months in a year, so the regular expression will be from 1 to 9. Because we cannot add the ranges like Oneto 10 it's unveiling only add ranges from 0 to 9 or 1 to 9. The higher limit is nine. If you add some range like this so it will think that your range is want one, because this zero is acting like a single corrector This in ordering similarly, if you have some ranges, like if you door some wrongly ranges like 1 to 55. So it means that you have ranged from 1 to 5 and then five. It doesn't mean you have range off 55 from one, so it will match one, but and it will match five. But it won't match with 55 because we have ranged from 1 to 5 and then we have five belonged to this character set enemies. First, we're going to create range from 1 to 9, so it will take it all the month from 1 to 9 8546 But some people, right month like 01 or 09 So we can at this hero, and we can make it to be optional. So I'm gonna add the Zito here, and I'm gonna make this one to be optional. So now we're matching from or month from 1 to 9, and then we have month off 10 and 11 and 12. So now we need to take care off the rest of the month. The 10th month, 11 month and 12 month. So I'm gonna use the alternation here. So first defining one group and ah, inside this group, I'm gonna add one alternation and you can add, then directly here. Or you can add lemon directly here, or you can add 12 directly here. So it will match all these months from 1 to 12. But it won't match with 13. So instead off adding dis notation 10 11 and 12 and making your regular expression long. You can use theater notation and you can make all these 01 toe inside. One character said the result will be same. So we have defined disagree, expression that will take care off our month. So I'm gonna got this from here and in this file, I'm going up a state. This is a regular expression for the month. Now. We need to create a great expression for the day. And for the day. We have days from one toe 30 or 31. So we need to find couple off ranges here. So seem like the month. The first range will be from 1 to 9. So I'm gonna add first range here, one tau nine. That will match 19 And also, we have to make this Toby 01 because some people ride date like, 01 or 09 Or did you wait? So I'm gonna add zero hair and I'm making it optional than 40. Next range. First, I'm gonna put it inside one group and now making one alternation here and now we need to take care off the next part that will take it off digit from 10 to 19. And the 1st 1 will be here one. And then we can have the character set off 0 to 9. That will take it off. 19. So now we need to take care off digit from 20 toe 29 and we can do that by defining when more ordination and ah, the 1st 1 will be to off course and the 2nd 1 will be same as 0 to 9 ridge. So we have made over counting from 1 to 29 now we only left two days off the month and that is 30 and 31. You can add oven ordination here and you can hear 30 and 31 separately. But instead of doing that, you can our tree and put zero and one inside. When Character said so, it will match 30 and also match 31 but it won't match it. 30 toe. No, Maybe you're thinking that some months have 30 days and some months have 31 days and how we can make of regular expression Toby certain about the day of the month? Well, the logic will be very difficult if you implement size thing in your regular expression, so instead off that you should leave this to your programming language because programming language can identify the number off days in a month. Whether 30 30 monorails 20 year for February. Very good. So leave it for programming language enemies. This is our regular expression for the days. So I'm gonna cut it from here, and I'm going toe based it. Here. No 40 gear part. You can create some regular expression like this, back slash D, and you can take four digits, so it will match for dessert. It could be any digit. It could be 2017. It could be 2000 and it could also be double blind double line. So instead of doing this kind off regular expression for digit, you should declare some kind off range for your digits so that your gear should lie. Vidin detained off the digit. So the day and I'm going to define here will be range from 2000 to 2 50 each year. Digit. So first, I'm going to add 20 here. Now, the next part could be from zero to form, because we're going to make it from 2000 to 2 15 So I'm gonna air the range from 0 to 4 for the next day, and I'm gonna make the next round, Toby zero toe night so we can take 0123 year four from this range, and we can take 0 to 9 from the last character sentry. So it will match 2001. It will match 2034 2049. But it won't match with 2000 and 50. So this is our last digit range. So I'm gonna put all this inside one group, and I'm gonna make one ordination. And I'm going to say that our did our digit could be from 2000 to 2049. Or it could be 2000 and 50. Now, you can see that we have matched all these digit, but it won't match with 2015 months because it doesn't lie with another age. And also, it won't match with 1 1999 off course. Now I'm gonna cut it from here, and I'm gonna be a state for the journal range from 4050. And now let's complete our regular expression for their in their testing. I'm gonna add a couple off validates that we have seen at the beginning off this lecture. Now let's combine our regular expression here, so the 1st 1 will be the month parts. I'm gonna copy the month part, and I'm going to paste it. So we have matched over month part. So no. For the next part, we have to match this dash or this forward slash So I'm gonna add one character started inside it. I'm gonna already forward slash and the dash. And also, we need to escape this forward slash And it's a good practice to escape this dash as well. You know, we have added this month part now for the next one. I'm gonna add this day part. So copping it from here and putting it right here, you know, copping this corrector said part again and putting it right here now for the gear part I'm gonna copy this year from here. And let's put it the night hit. See? No, we have matched all these Date nine case. If I have some wrong gate like 32-24 doctors on 17 this one is not matching. If I have some date like 0 9-30 to 40 day and 2017 for the year, it's not matching, but it will match with the right formative date, and that is nine. Could be other month. 20 will be over date and the year could be over 2050 c. We found a match. And lastly, as we're not backer offenses, these growth. So it's Ah, good. Practice toe un, capture them and make them known. Captain Group. So also this group as well. And also this last group here. No, if I are some day like zero, six hour month and date will be 14 and the year will be 2028. This was married. Now, if I add forward slash instead off dash, you can still see that reform image. So it's not a very good practice to law user toe use either the forward slash or the dash here so we can restrict our user to use only dash or the flower Slash by making this one in tow group. So I'm gonna put first this forward slash and dash inside one group. Now I have put it in one group. Now, I can use this group by using the back references because we have captured this group. So insert off adding this second time right here, I'm gonna use the back reference and there's back reference is back slash one. No, you can see that this one is not matching. So whatever the first former user adopt weathers forward slash or dash, the 2nd 1 will be exactly like that one. And remember that we have only one captured group, this one. That's why this backslash one belong toe this captured group North ease non capturing group because we have made these group to be known, capturing one. So now we have made of a regular expression for date. So I'm gonna copy it from here and let's put it right here in this fight. 45. Lecture 44 Times: for creating regular expression For time, we will create two regular expression. First, regular expression will be for 12 hour former, and the 2nd 1 will be for 24 hour time. Former. So in the first regular expression or 12 hour former it we will have our from 1 to 12 minutes from 0 to 59 2nd from 0 to 59 as well. So in the 24 hour form, it we will have our from 0 to 23 minutes from 0 to 59 2nd from 0 to 59 as well. So in order to create first 12 hour former time, so first ending the anchors here and over time will be from the range off one toe 12. But it we cannot write 1 to 12. Here we can only are the range from 1 to 9. So I'm gonna add her 129 range. It will match one, 23 and we also have to done on the multi line more because we're using the anchors so it would match 1 to 9. And after that, we have to define one alternation for our other time, like 10 o'clock, 11 oclock and 12 o'clock. So first I'm gonna put this inside one growth liquid it in our last movie, Off cares. And then inside this group, I'm gonna add ordination, and I'm going to define it for 01 toe. So this one will match 1234569 done in 11 and 12. And sometimes some people prefer to write time like this. 01 So I'm gonna air the zero at the beginning like we did before, and I'm going to make it optional. So it'll match 0 to 9, but it won't match 0 10 because it's not for mated. So we have made over 12. Former. So first, I'm gonna cut this from here, and I'm going toe paste it in this file off. Tell a form it at the place off hours and I'll ask A year to tiger expression. 40 minutes. So for demeanors, we have minutes from 0 to 59 and ah, it's very easy to change to create 40 minutes. All we have to do first, let's get rid off these death strings First, the first group will be from 0 to 5 because we want toe. Make this first, Toby. 01 toe, 345 But not with the six and all 40. Next part. We can make the next part from zero toe nine that will match 00 Also match 10. Also match 2039 for demeanors. 44 40 minutes. 55. But it won't Maginness 60. So this other day, in 40 minutes it will match all the numbers from Oneto 59. But it won't match with just the one because we have not made anything optional. So I'm gonna make the 1st 1 to be optional so that it could also match in case if the user prefer his time, Toby, like, one minute without any leading zero. Where? The beginning. So this one is regular expression for over minutes. So I'm gonna cut it from here, and I'm goingto be a state here for the miners And 42nd. The duggar expression will be same for second here as well, because we have second from 0 to 59. No, let's combine our travel or for mitt regular expression. So first I'm gonna cut this over from here, and I'm going to paste it right here. And then I'm going to use the colon here because people prefer colon inside their time. It could be 01 Golan. 55 minutes. So that's why I have added this colon. Not if minutes part. I'm gonna copy this minute part and pieced it right here inside one group. And same for the second part, I'm gonna bastes the same thing right here as well. So this one will match one o'clock, 55 minutes and 00 seconds. But if we have some time like zero to Colon 34 we're not briefing the second part, we can do that by making this whole second part to be optional. We can do that by putting all this inside when I grow up, and we can make this group to be optional one. Now you can see that we have married this one, and we can also match something like 21 is also a valid time. Or you can make it do 01 It's up to you. So this is the regular expression for the well off form it. There is only one thing left, and that is using the AM and PM notation in your fellow for Mitt because when we are using the drug war format we use I am to represent the midnight after time and P m 40 daytime after 12 o'clock. So I'm gonna add one group here. But I did then and ah, in this group, I'm gonna add a m alternation bm and ah, let's make this group to be optional. So in case if someone adhere, am we found a match and ah, let's also at the space before this group off AM and PM, And in case if some money is using the upper elected no station off AM and PM, you can are the operator am and B m a here as well. It's a good idea, so this other expression will match time. But no, you can see that this last part is not matching it because we are not having the space inside the AM and PM part, and we have made this group to be optional, nor displacement. So I'm gonna remove this place from here, and I'm gonna put the space inside the alternation so that the space would be optional here as well, so it will match all the time from AM to PM and the second part and the ending this part off AM and PM is optional, including space. So now we use this group. So now let's also used these groups Toby known, captured one. So I'm going to use non capturing notation here in this group as well and also inside this group and lastly in this group as well. So this is the regular expression for 12 or former. Now I'm gonna cut this regular expression from here and let's put it here. This is a complete regular expression for 12 form it and Knoller's create regular expression for over 24 hour former and demeanors and second will be same as what we had Aaliyah. But we need to define when range for over hours. So as in 24 hour form it we have 0 to 23 hours because after midnight the hour is zero, so we need to define range from 0 to 23. So I'm gonna remove all these testing from here, and I'm going toe define range from zero toe nine that will take care from digit from zero toe 129 and also in case if we have Double zero are. Then that's at the anchors to match the starting and ending off line. Now you can see that we're not matching to steal anymore. So same thing that we have done before making this leader to be optional. And after that, we need to add one ordination here. And before doing that, I'm gonna add one group inside. We're going to wear the ordination. And inside this ordination, the range will be from 0 to 9 and want with your canine dental match, all the digit from 10 toe 19. And now we need to take care off 20 toe 23. So I'm gonna evermore ordination. And this time it will be for two. And we need just 2122 23. So I'm gonna add range from 0 to 3 C. Now, we have matched this pattern off 0 to 23 so it won't Magic 24. It will match all the digit from 0 to 23. So I'm gonna copied this from here and paste it in the 24 or form it. No, we have already made the minute part, so I'm gonna air the minute part here firstly, Colon so that we can have time like 19 colon and then adding the minute part inside one group so that we can have minute like 1959. And for the next part, I'm gonna add one group. This is our second part, and I'm going to make it optional. And also the colonnade. The beginning off this one. In case if we have something like 24 is the over and 44 60 minute and 56 is the second. So this is a regular expression for 24 or former and in 24 hour way sometime, have yes to your G empty plus five or minus five Air dined off our 24 hour time. So if you want to wear that, you can add one more group here and you can make this group to be optional as well. And inside you can add your gmt or it could be E S t. So it will match time like 20 hours, 56 minutes and then GMT. If you want where to call on or space here. You can add the space inside this group off GMT and E. S. T ordination so that you can allow this space that I have added this here. So as we're using these group and we don't want toe use the back references. So let's make them known Captain Group, all these groups so making this group to be known, capturing one. Also this group to be known, capturing one as well. And the first group to be non capturing one as well. So this is our 24 hour form. Eight time regular expression. I'm gonna copy it from here. And let's put it for you in here so that you can use it later when you have this file off time dot txt. 46. Lecture 45 Postal Codes: There is only one rule for the postal course when it comes to creating regular expression, and that is no rule because different countries have different postal codes. For example, if you have to match the postal court off Pakistan, it will be five digit only guard. Simple. And if you have to match the poster court off India, it's also one of the most simplest postal court to clear, and that is only six digits. But for Canada, the poster court will be something like this. So a nine a means a means any alphabet. Here are the place off A and nine means any alphabet from zero tonight, then the next a means any alphabet and then space and then nine, and then any alphabet e represent any of over and then nine represent any number. And then for the U. S. A. The post record will be five digits or five majors. Dash 12344 digits. Now, for the UK, the poster cores are acquired difficult to clear. If I can show you the LK convicted media hair on Wikipedia, you can find information off post courts in the United Kingdom where you will also learn about the former off the post court. Here, you can see the form it in the relegation tab. This is the form it off, creating poster court, the a A. Represent any of Robert, any alphabet here and any of of it here and then any digit from 0 to 9 hair and then Elding alphabet hair space than any in digit any alphabet and any of forward. And it can also be, according to this expression, this former the post record off UK. Some cities could be like any Faubert followed by a digit than any alphabet followed by space than any number followed by any off a bit. And then any of a bet, airtime and then same. You can see that we found this. Form it here. So in the form it off UK, something is common and that is the ending part. Nine. A nine means any number and a means any alphabet from A to Z, so we can still create regular expression for UK as well. So, first I'm gonna create regular expression for the Postal Code of Pakistan. It's very simple to create, as the Pakistan Poster court could only have five digits. So I'm going to use the back slash d and it could be exactly five digit and using. The anchors are the starting in the beginning as well. So it will match 12345 It remarried 54 700. It will match 59 321 But it won't match with 123456 So this is the poster court for Pakistan. I'm gonna copy it from here and left based it in this file poster course. This is for Pakistan. And now for the India, the postal gored limit is six majors. So it will match all the courts upto 60 yet. So this is the simplest gored, off matching Indian postal course. I'm gonna go Pete from here, and I'm going toe paste it in the NDR tab on all ex. Create regular expression to match the Canadian poster court. Now, first the testing. I'm gonna add one. Form it here. So this Canadian Postal Court is very easy. We guard first alphabet, then followed by a digit than alphabet again. Then space then did your dinner, Thurbert. And then did you Turton? So first I'm gonna add one anchors for matching, starting and ending and no first regard. So I'm going to fine here capital, a toe Z range, and then you can see regard digit part. Then we guard again this range off capital A to Z. So I'm gonna add it right here in regards space. And then we got digit Bart. And then we got capital A to Z. And then we got digital then. But this is our Canady in court. It could be like Z five Vai space nine oh three is also developed. Kennedy in court. I'm not sure whether there is some city according to this post accord, but this is valued for Canadian poster court. Form it. I'm talking about former redecorating, the expression toe mash deformity. Not the actual thing. Whether this poster cord have some city in Canada or Nord. So this is our postal court 40 Canadian former. I'm gonna cut it from here. Dollars based it in the Canadian tab and all. Let's create our USA Postal gored now in the testing panel, I'm gonna pay us the USA postal cord form it. And that is five digit or five digit dash four digit. So first adding the starting and ending anchors. And first I'm gonna add it could be five did years. We matched this one and no, let's match this one. So I'm gonna add one group here and inside this group, I'm gonna add first dash to mash this stash and then you can have four digit if you are followed the second form it. So we have matched this 2nd 1 but not 1st 1 anymore. So I'm gonna make this group to be optional one. So either the poster court belong from the first form it or it could belong from the second Form it off this one. And also we use this group, so we need toe on capture this one to make it known Capturing group. So this is our regular expression for matching USA Post records. I'm gonna cut it from here and all that spaced it in this file so that you can have this violator. No, let's get year. The UK formatted postal code. Now, the first thing first in the testing. I'm gonna pasty form eight off UK Postal cord. This is our form it now the first thing that is common here we can divide the struggle expression into two parts. First part is this one. You can see that we got first alphabet and then the digit all it could be first, all for Britain than two digit. Or it could be too well for birds. Oven digit or two alphabets, two digits. So first, we're going to create regular expression for matching these four for mix so you can see that regard first the alphabet. So first starting the starting and ending anchors. So first, you can have alphabet one or two time because you can see that first we guard vinyl for bet right here. And then we got to alphabet here in these two ones. So I'm gonna add one range from Capital A to Z, and it could be 1 to 2 times, and then you can see that regard the digit part. And did you could also be 1 to 2 times. So I'm gonna add backslash D, and I'm going to make it one or two time as well. Then you can see that regard space and after that, regard the common part and that is digit followed by the wealth of it. So I'm gonna add 1st 1 digit and then a character set from A to Z, and it should be too. See, now we have made this regular expression that will match these four expressions. So first, I'm gonna copy this one and be a stick right here in the UK this tab. No, I'm going to remove the struggle expression. And you should forget these tests during as well. No, I'm gonna create one regular expression that will match these last two formers. You can see that in these test ring. In these formers, we guard alphabets one or two timer the beginning. Then we got digit. And then we got one hell Faubert. So I'm going to define here, correct a range from A to Z and it could be want to two time and then you can see that regard Digit here. After that you can see the regard. Vernal forbears. So defining range again here. Then you can see regard space and then the same part again. And that waas first regard digit and then we got alphabet twice sweating range from it will see and making it too two times. See? No, we have Mattis $1 copy this one from here, and I'm going to paste it right here. Let's also pieced it's dust rings at the top and digest all the testing that we used for our early regular expression that I tear at the top now completing regular expression by combining these two regular expression. So this is our second part that we have just created for these two? No, I'm gonna copy this first part and the hair first. Let's put this one inside when grope, and I'm gonna use one alternation here. And I'm going to define but more group here and put the first part that we have made earlier to match these four test strings when I put them here. Now you can see there. We have mashed these testing so it will match this regular expression off zagged for oh, Space five BP. You can see that we found a match. No, this is the regular expression for the UK and also make them Toby known capturing groups. So this is the complete regular expression for matching poster court off UK. So I'm gonna copy them and let's be a state right here. Complete you care, saving this one. Done 47. Lecture 46 Credit Crads Numbers: No. Let's create regular expression for matching credit card numbers in credit card. We have many companies, so I'm gonna cover five major carrot yard companies, including Visa, Discover, China, UnionPay, MasterCard and American Express. Now all these Visa card have something unique in their number. For example, Visa has 16 digit discovered. Also has a 16 digit. Same for China Unionpay. Same for MasterCard. But American Express have 15 digits only. And for the Visa card, the Visa card card card number more started. Four. So it should be something like this for the at the beginning without any spaces. Or it could be for did years, separated by spaces or duchess. Now, for the Discover card, it must start with 60 double fun, and it's also the 16 digit card car number, so it could be six years. Everyone are the beginning, or it could be in the form off. Four chunks and every junk have four digit, and the starting should be 60 double. In China, UnionPay must start with the digit off 62 same, like the others, it will have 16 digit with dashes by making the four chunks, or it could have the spaces are the place off dash or without any space? Or there's something like this. No. For the MasterCard, the 1st 2 digit must be within the range off 51 to 55. It could be 50. Wondered the beginning or 16 digit without any spaces or dashes, or some use deformity with spaces or dishes. Or it could be 52. Where the beginning. It could be 53 years beginning 54 55. Now the American Express has only 15 digits, and it must start with 34 or 37. So the car car number will be something like this without any space. 37 hurt the beginning or with space or dashes than four digits. Er the beginning. 60 years in the middle and five digits are the end total 15. Or it could be 34 at the beginning. No. First, we will create a regular expression that will match these 16 digits company. And then we will create one regular expression that will match on Lee American Express and aired, and we will combine them so first next, create regular expression for visa discover, China, UnionPay and MasterCard. No in the testing. I'm gonna put all the four minutes here you can see regard for Mitt for China, Unionpay discover. And then we guard the MasterCard Former Turned and the visa. So as all these guard guard, including Visa, MasterCard, Discover, and China unionpay have 16 digits. So I'm gonna add first the anchors hair and I have already turned on this multi line em moored and no insiders. And could I'm gonna make this one Toby back such d four times, hoping it One time alerts repeated over and over for four times. Now you can see that we have match this one. No. As you can notice here we got dash here, and it's possible it could be dash or the space here as well. So I'm gonna add one character said that will include ash or the space. And we also have to escape this stash. And I'm gonna copied this from here and based it right here and right here. You can see that we have matched all these patrons that have dash or space, but without any dye short space, we're not matching them. So I'm gonna make them, Toby Optional this one to be optional. And this one to be optional? No, as all these guards have something unique at the beginning, For example, Visa card must have Ford at the beginning. And then for the next three part, it could be anything. So this part off four digit, I'm going to remove this one. And now, first, let's make it specifically for the visa card. So I'm going to define here one group in which I'm going to say that the first digit must be four. And then there could be any digit three times after the four. Now we have married this visible, so it will match any with the card that have forward the beginning. It will match, discard as well and discard as well. No, for focusing mustard guard MasterCard must have 51 to 55 air the beginning, So seem like what we did with the visa card. I'm going to do the same thing for the master guard as well inside this group. So I'm gonna add one alternation here and in which I'm going to say that the 1st 2 digit should be from 50 to 55. So the rain will be from 51 to 55. So the range will be from 1 to 5 here. And then you can have so did years. Exactly 200 years. Now you can see that we have marriage. Just one as well. So we are taking four digits any four digits from this one. Then we're taking four digits from this one fourty years from this one. And then we're taking two digits from here and two digits from this alternation. So this one will match MasterCard and also the viselman. No, we need toe mash This pattern off this government, as I told you, that Discover card must have 60 development are the beginning. So we're going to do the same thing right here as well. So inside this group, I'm gonna add one coordination, and I'm going to say that it could be 60 double one. See, discoveries also matched. Now, 40 China unionpay china unionpay has also 16 digit, and it should have 60 to wear the beginning. So I'm gonna add one alternation here, and I'm gonna say that it could be 60 to wear the beginning, and then you can have any 200 years. See, now we have matched China as well. So this one will also match this guard. But this one more match. Any guards starting with 63 See? And this 11 match 40. This government starting with 61 and for checking Monster guard. If there is 56 at the beginning, it won't match that one either. And for the visa, it won't match with anything other than four at the beginning. So now we have created a regular expression that will match all these 4 16 digit cards Visa , MasterCard, Discover and China Unionpay. Now, let's focus on our American Express card, so I'm gonna copy the struggle expression from here. I'm going toe based it in this fire. So this regular expression cover all these guards off. 16 did years length, including Visa, MasterCard, discover in China. Unionpay. So now I'm going to remove Hold regular expression from here and no, Let's get a year ago Expression for the American Express. So I'm gonna first beast the syntax for American Express card. You can see that it must start with 34 or 37. So same thing that we have done before. We could have four digits are the beginning. Then we can have six digits are the middle, and then we can have five Did years, Erda and and same thing that we have done earlier for the dash and space. We also have to escape this one and also making it optional toe mash. The whole expression. And I didn't get Try Taylor as well. So you know we have Mac, this one? No, the next parties. The American Express Guard must start with 34 or 37. So I'm going to remove the first part off four digits and ah, I'm going to add one group here, so I'm gonna say here it could be 34 or 37 followed by your digits. See? No, we have phoned Amat. If I are something here to be 33 the rest of the thing, you can see that we have not any match you can Also Did I write it something like this? You can use the character. 13. Start off using the alternation, for example. You can write it like this. You can put four and seven inside. One character said it's completely up to you know, we have found the match that matched the slugger expression. So I'm gonna copy the circle expression that has completely valid rejects for American Express card card. And I'm going toe put it in here. No alerts create our complete regular expression. So I'm gonna copy this regular expression without the anchors off 16 dangers that we have created earlier. And first, I'm going to put this one inside one group. And then I'm going to put this regular expression that we have created for these guards at the beginning inside one more group and we need to wear the alternation here. So it could be this 16 digit card card, or it could be this 15 digit cargo. You can see that we have found this match. We are matching this viselman. We're matching this. MasterCard from 51 to 55 were matching discover from $60 under the beginning, we are matching China unionpay as well. No. Lastly, you can see that these are the groups and we're not do using them. So we need toe, make them known capturing so that our regular expression work absently and also this group as well. And then you can see that we got group here, and then we got this group here. So this is the combined regular expression that will match these four major complaints. China Unionpay, Discover Card and the MasterCard, Visa and American Express. There are a lot off other card car companies. You can create regular expression for those companies as well. It's completely up to, you know. Lastly, we'll be applying when validation on our regular expression so that we can encounter the possibility off receiving something other than our former. As you can notice here, I made this character set off dash and space to be optional in this American Express credit card. And also you can see that this is the Kurd card off 16 digits. Image. I have made this character start off dash and space Toby optional as well, so the user can air dash or he can act space. It's completely up to him, but at the same time he can add Dash in the first part, and he can air space in the next second part. There's not very tempting, for example, in this American Express card. If I remove this pace from here and he start off the art if I our space. You can see that we are still getting the match. However, regard the dash in the first part. So we are making this exception in our credit card that the user can rd dash in the first part and then he can choose space as well. In this second part, that's not very good, right? So we can limit over user toe pick only one formal he can pick, deform it off, dash, or he can pick the form it off space and throughout occurred card off a credit card form, it will be Stick to that dash or space. So for restricting our user to pick only one form it. Whether it's dash or space, we can use back references to accomplish this task. So first, I'm gonna apply back conferences on the first part off a regular expression that is 16 digit guard part. So I'm gonna put all this character cert that is optional inside one group. No, we made this group and we are capturing this group. Not like them, because these are the non capturing cope that we made earlier. So we made this group and this group is capturing the content inside this group? No. We can use the back references, toe get only that former Vista user is going to select inside this captured group. So for using back references, this is our first capturing group. So I'm gonna remove this optional characters from here and instead off that I'm gonna add the back reference off this captured group. And this is our first captured group. So as this group is our first capture group, so I'm gonna add backslash one toe point, this group and all. Same thing here. I'm gonna remove all this character set and in start off that I'm gonna add backslash one now. Same which we have done with the 16 digit card. I'm gonna do the same thing for our American Express 15 digit card, So I'm gonna put this dash and speeds. Corrector said this option one inside one group? No, we have made this group and we capture the Earth's debt out. This is our second captured group. So now we can reference this group any place we warned. So instead, off putting dis notation right here, I'm going to remove it and air the back reference off our second group and its back reference addresses backslash too. So this back slash to belong to this second captured group and this back slash one belong to this first captured group. You can see that regard to back references off this first group. No, if I remove this dash from here and in start off daddy fired space, you can see that we're not finding any match. And if I add dash again, we phone them at. And if I remove this dash from here and our space and in the second part, if I have dash, we're not finding them at so either. We can pick any formal. We can have species at both places, or we can have dashes airport places. So this is the power off. Using back references to limit the user only toe pick one for Mitt. So engaged in this mastercard. If I move this dash from here and pick space, you can see that we're not matching anymore. And if i r dash again, we found a much So this is very helpful technique. Off back references. If you're having problems while grasping this concept, I will suggest you toe goto the lecture off back reference and make your concept clear. So, no, I'm gonna copy this whole regular expression from here and in this file, off grade card numbers. I'm going toe paste it for you so that you can see this later when you have this fun. 48. Lecture 47 Passwords: no. Lastly, this luckier will cover regular expression for passwords. So when I said regular expression for password, I mean that then some user register on some site. Your regular expression can make your user toe are certain thing while choosing the password. I'm not talking about the weather, the user enter right password or wrong password. So the restriction we are going to apply on password by using regular expression will be must be within the length off air to 15 characters and password. At least have one digits and von Laurito, Z and Capital A to Z off Over, and your password must have at least one symbol. No, let's create passwords that will cover all these restrictions. So first adding from star toe end anchors and turning on the multi line moored. So first the user can choose any type off password he want. So I'm gonna use divide card here. So if I heard static, static means that you can add anything here as many time he want. But I want to make my password from 8 to 16 so I'm not going to use this quantified off static. Instead, I'm going to make it from it so 16 limit and putting it in caliber asses. So only those passwords that contain length bidden 8 to 16 will be acquitted. For example, if we have passed for, like jazz a backroom, it's valid if I had a couple off things after it. And now you can see that you're snowed well, it anymore because it's exceeding the limit off. 16. It's valid here, but it's not valid after crossing the 16 limit. So we have made one restriction on this password. That password must live within 8 to 16 characters. No, the first restriction I'm going to add on password will be the password must contain one digits. At least one did it. So I'm gonna add one look ahead assertion. And in this look ahead a session. I'm going to say that. Look ahead in this viral Gardez to 16 if you can find anything, but it must have at least one digit. So if I have passport off Josip a krump, you can see there's not matching. If I heard one digit here, you can see that we found a match. You can are digit at any place to match this one. So this one, we'll take care off the digit restriction. Now I'm going to add one more restriction. That will take care that my password must contain at least one lower forward. So look ahead in the password that contain anything. But it should have at least one lore A to Z. We can see that we found this match. But in case if I heard something here Toby Blue eye all in capital Munn blew her top. And ah, you can see that we're not matching anything. If I are digit here, we still don't have any match. But if I add lower letter Lord corrector like being, we found a match. So this one will take care off. Over Lord of Robert. Now I'm going to air the same assertion here. Toby, look ahead if you can find anything in the password, but it must contain upper A to Z. So you can see that we found this match and start off that if I have some hair. Toby Blue sky 44 4 We don't have any match. But if I had one off about from the upper range like B, we found a match and lastly I'm going to do the same thing here for the symbol as well. So that our password must contain any symbol including hash, dollar and negation, etcetera, etcetera. So I'm gonna do the same thing here. I'm going to define when look ahead, positive assertion. And I'm going to say that our password could be anything but it should have one character said, including all these symbols from my keyboard. So I'm gonna paste all the symbol from my keyboard that I want to include in my password. And also I have to escape this dash Also this ending bracket and ah, this looks good. No, in case, if I had one password here like Loop Capital from T. And did you, Toby 89 and then adding the symbol you can see there we found a match, and this password has exactly eight length. So this is the regular expression for matching password that should contain at least one digit at least, Lord alphabet, At least one apart alphabet and at least one symbol and its length should be between 8 to 15 characters 49. Goodbye: it's time to say goodbye. This is it for the scores. If you really enjoyed the scores, you can share your thoughts by adding a great review to the scores. I tried my best to complete the scores by giving you practical skills. So if you want to know more off my courses, you can check out the library off this platform. Or you can visit my website johnson backroom dot com. And in the course coupon stab, he will find all off my courses. You can subscribe my YouTube channel, which is just a gram. You can follow me on Lincoln, which is charged with a crime. You can follow me on Twitter, which is just a grim, and you can follow me on instagram, which is jazz ib dart a crumb. So have a great day and happy learning