What are Regular Expressions and how to learn it

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this is a regular expression and yes I'll give you on that that it looks weird a lot weird in this video we're going to talk about what is regular expression how you can use them what programming language do you need to learn in order to use regular expression how they are so much powerful and some tips and important instructions regarding regular expression and their usage on web Android and iOS so let's get started it makes you see this john deere [Music] there are two important key points that I want to get started in this video the number one point is the programming community don't refer them as regular expression because it's a little bit mouthful all of my name is still a little bit mouthful but still I am saying this so programming community doesn't say that it's regular expression usually they use a short form of that also known as regex and in fact all the programmers refer to this as regex point number two and which is very important regular expression or also known as regex is not at all a programming language a lot of people get this misconception that in order to use the regex we need to learn Java or we need to learn Python no they are not at all a property of any programming language all the programming language in fact have the ability to use the regular expression some use them as a by default method for some you have to download some packages out you have to use third-party packages but apart from that all the programming languages like Python Ruby Java JavaScript PHP all of them have the capability and ability to use regex so the questions still have what we have here is what is reg X now reg X is not a programming language let's get clear first of all that now reg X is simply a pattern matching thing so yes it is little bit weird to understand but let me try to explain that in this way when you open up any document you just press control F or command F and started to type searching for the things your Microsoft Word or maybe your web page where you have opened the source code and tried to hit command F or control f it just searches you the thing but sometimes you want to do a little bit more onto the search maybe your search criteria is I want to look up for all the email address on this web page yes of course you're just searching with ctrl F is not going to give you all the email address present on the webpage because some of the emails might be from at gmail.com some of them might be Yahoo dot code or in some of them might be yahoo.com so it's not easier to find with just our regular control F or command F there comes your regular expression with regular expression it's something like a strike on a steroid it's also referred to this what I mean by that whenever you want to search something maybe into a database you write a query select star from table this lessness and this star means select everything from that and this regular expression is something like estwick on a steroid you can search and can define your exact pattern that you are looking up onto the web page or maybe onto a big document file and there can be a lot of patterns like that you might have noticed that some website pushes you that you should use the password in uppercase lowercase some letters and some special characters as well this is all done using regular expressions forcing a user to write correct format of the email forcing the user to use a very secure password or maybe entering a credit-card number into a write format these are just of the few examples where regular expressions are used but it can do way beyond this regular expressions or regex can give you exact amount of data or exact data what you are looking up in a big huge chunk of file this data or this information this set of information is otherwise so hard to find out I'm not saying you cannot find it obviously you can find it but since you are a computer user especially a programmer it doesn't make sense to dig up into the whole file it makes sense that you write some exact script that can find out what you are looking up for but this also comes up to some interesting usage of regular expression just taking another use case scenario let us assume that you want to write a simple script that goes into a personal computer of the person and then try to find out the bootloader or the grub file and then going into that graph file and writing some mumbo-jumbo text simply just corrupting the computer so this can all be possible using the regex or regular expression because you'll be working on to a computer in which you have no idea how the directory structures are still you are able to find out your exact file that you are looking up for this is where the regex comes into play so yes a lot of virus bombs Trojans want to cry all these are somehow inspired with regex not totally but yes a huge part of writing such kind of files is actually dependent on regex or regular expression I would also like to add up here that if you are into information security penetration testing Reza is kind of a really good thing to learn you might be asking why let me explain that as well now whenever you are into penetration testing or sort of ethical hacking the main job of what you will be doing here is analyzing the thing it's not all about using the tools and everything many times you have to analyze the things for example it's a very less data or maybe a via data and you want to find out some specific chunk of information for that you have to just get let us say you have launched a Wireshark and you want to grab some information from it a good way of analyzing the things would be using writing your own custom scripts that uses a specific data sets and find them using regular expression this makes you from a regular pen tester to a pro pen tester since you are able to write your own scripts and find your own data you'll be exploring the things that nobody has ever explored okay so now that you understand that this weird-looking string that I showed you in the first of the video what is this and where the usage comes up in here the next common question that I get while explaining about the regex or regular expression is so what programming language should I be learning in order to master the regex the answer is choose whatever you are on already now since regex is not a programming language it's not a plug-in it's just a way of finding the things you should always be stuck to whatever the language you are maybe you are a PHP guy maybe you are Python maybe you are into Java or JavaScript wherever you are just stay there and regex is something that you adds onto top of your programming language and there is no such thing as best programming language with regex or worst programming language with regex regex works fine with all programming language so another common question is how much time should I spend with regex now before we move on to that regex is hard and I give you on that it's not easy to learn and write regex scripts people have spent like days and sometimes many hours and days to just write a simple this much long regex script but this is super powerful so I get you on that that it is hard and it is time-consuming as well so how much time you should be spending to learn regex now it depends what you really want to do with regex in case you are into the domain of pen testing or cybersecurity or maybe network traitor Linux administrator then regex is super powerful and super helpful for you you should spend maybe months on learning the regex alone it is it is going to take you to the next level of that but again if you are just a regular web developer iOS or Android developer then it's not that you have to go into in depth of that again giving you on to the point that if you go into that that's super helpful for you but in case you don't want to go into too much depth of that that's completely okay and fine as well so how much depth should you be talking about so in case you just want to touch the surface or the regex I recommend this website regex are.com this is one of the favorite resource that you can use for using the regular expression now for all the guys who are saying that hey this is sponsored by regex hey come on get a life in all of my offline boot camp or online boot camp I recommend this resource regex are is one of my favorite resource to learn and I have particular reasons for them reason number one it has a QuickStart guide on the left hand side so that you can learn about the regular expression without digging too much deep into what are the square brackets what is the slashes Astrakhan all about that it has a QuickStart guide on top of that it has some options that allows you to write regular expression form any programming language yes regular expression is same for all programming language but there are subtle differences just a few minor one of them and this website allows you to have all those differences to be enabled or disabled at the go and the second most important reason why I love this website is its community section there is a community tab on this website on which you can go and can find out common regular expressions for example you want to have a regular expression to enforce the password thing uppercase lowercase letters numbers and all these weird stuff so there are already cooked up and very well defined regex already being there for you but here is a quick word of caution until and unless you don't understand what the code is saying you should not implement that code so first of all try to understand what are the basics of regex or whenever you see a regex you can at least try to think that hey this is what it's doing and that's fine so these are my reasons why I love this website now this is not like this is the only resource available on the web there are of other resources that can help you to understand the regex I also recommend that if you find out some good books related to your programming language or just regex go ahead and buy them it's something that you want to invest in yourself the more you'll be investing in learning the more are the gateways that open up to earning now here is an important and very very important instruction if I would have an alarm I would just like to put it right now be very cautious while using the regular expression you can get into the legal trouble as well yes regular expression usage can land up into your legal trouble as well how you might be asking let me explain you that when you try to scrape on any website for looking up for the email or any kind of data this is not at all allowed not at all allowed now some website allows you to dig up the data add to certain extent but most of the website doesn't allow this so it can be a little bit dangerous at that site as well so if you are a guy who is looking up and thinking that hey I'll make a website that looks up on to the all emails or maybe a specific data on to a website and I'll use regular expression on that trust me if that website guys find out that you are doing this this is not at all legal if you want to take the excess of any website or such resources there are always api's available for that website if that website want to share its resources with you regular expressions are useful still but it's not like that you can just launch them on any website and can use that it is illegal my second big advice is don't use regular expression in your Android or iOS app now this is super important if you are submitting your iOS app then for sure that if you are using too much of the regular expression for scraping some data on the website this is against the Apple policy and your app may get banned or may even not be able to submit it on to the website same case goes for Android in Android since the initial hurdle phase of submitting your app is super easy that means you'll be able to submit your app that uses a regular expression but as soon as Google will find out and trust me it will find out it may kick up your existing app or even may ban up your complete account and your existing all other apps as well so be super cautious while using the Reg this was not to scare you this was just to give you the fairground basis at what extent you can use regex and where you should not be using it that's it for this video and go in the comment section and write what you would like to see me next making up on this channel I always read all of your comments and I do really appreciate the love that you are throwing up on this channel keep it coming I really really enjoy that this amount of love is coming at this channel I do really appreciate it that's it for this video and in case you are new at this channel we talked a lot about tech and programming so do consider hitting the subscribe button if you think that this is your thing for tech and that's it for this video I'll surely catch you up [Music] [Applause] [Music]
Info
Channel: Hitesh Choudhary
Views: 47,758
Rating: undefined out of 5
Keywords: Programming, computers, code, hacking, information, Security, iOS, iPhone, udemy, online-courses, free-coupons, udemy-coupons, udemy-courses, android, iphone, reactjs, web-development, RegEx, Regular Expressions, Pentesting, System admin, Python
Id: ykSuHWhh5hc
Channel Id: undefined
Length: 12min 29sec (749 seconds)
Published: Tue Nov 28 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.