In this regular expressions (regex) tutorial, we're going to be learning how to match patterns of text. Regular expressions are extremely useful for matching common patterns of text such as email addresses, phone numbers, URLs, etc. Almost every programming language has a regular expression library, so learning regular expressions with not only help you with finding patterns in your text editors, but also you'll be able to use these programming libraries to search for patterns programmatically as well. Let's get started...
The code from this video can be found at:
Python Regex Tutorial:
If you enjoy these videos and would like to support my channel, I would greatly appreciate any assistance through my Patreon account:
Or a one-time contribution through PayPal:
If you would like to see additional ways in which you can support the channel, you can check out my support page:
Equipment I use and books I recommend:
You can find me on:
My website - http://coreyms.com/
Facebook - https://www.facebook.com/CoreyMSchafer
Twitter - https://twitter.com/CoreyMSchafer
Google Plus - https://plus.google.com/+CoreySchafer44/posts
Instagram - https://www.instagram.com/coreymschafer/
Dude, this was so great, I couldn't find any easy to understand tutorial, they were all super long and used a lot of words that I wasn't sure if I understand correctly, they didn't show clear examples and I was supposed to remember that whole block of text somehow... With your tutorial I feel like I'm good to go already 💪 Thanks a lot man 🙏 Did you make that advanced tutorial as well?
Hey Corey, have a quick question, I'm trying to match the text "V.M." in the following simple string:
V.M. stands for virtual machine.
With the following regular expression:
However, my text editor (Notepad++) keeps saying it can't find any match with that, whereas it has no problem finding a match with something like the following regular expression:
Any idea why the first one isn't working?
You have it very easy. Do update your comments on this video, if you post any advanced video on RE. I want to construct an RE to parse a csv, generated from Excel (with certain column having a comma. such as address - so those will be surrounded with double-quotes), some columns could have data/ no-data/ or some rows have 10 columns filled or some rows have more (say 15)
Regex just totally messes you up, lol. But the video did help. What ind like, is a static image, with lines drawn to the regex, saying ... this is group.. this does that.. etc. I know it can be found some places.
How can I utilize Regular Expression to Group customer names in a a SQL table, where customer names are listed more than 1000 times in some cases and in many cases spelled differently? Thanks in advance.
Thanks for this video Corey. I have it bookmarked and keep referencing back to it. It's super easy to understand and I appreciate you producing this content. Would it be possible for you to also link to, or just outright add to the description notes, that regex cheat sheet you have open on the side panel of Atom. It's super useful and I find that I keep scrolling to parts of the video just to catch a glimpse of it here and there.
Hey there. I have those code snippets linked in the description section. Here is a link specifically to that cheat sheet:
Hi Corey! I've encountered a problem with the word boundary. I copied your regex into my Atom's search bar ('\bHa') and had in my text file text 'Ha HaHa'. However, when I used that regex, it returned to me 3 results (so all the Ha's). Could you please tell me what could be wrong here?
hi sir, i appreciate your video, it really easy to learn on your video, but i have a question, how about the 3rd example in your email.txt, it has a 3 dash, but you only put a 2 dash. is it not separated the first word and the numbers? because in your regex you combined it as well.
Hey there. That is because with the '+' looks for one or more of those characters. For example, there are multiple of the same letters as well, but it goes over all of those until it hits the @ symbol. Hope that makes sense.
This was my first video on learning regular expressions and began to think Regex isn't that hard at all, then reading the comments its apparent thats its actual you whose good at teach. Great tutorial. Thanks!
Whenever I see talented people like you giving perfect explanations I feel confident to say: things are not difficult, just badly explain. Thanks to you I was able to FINALLY understand regex and actually start looking at it very friendly. THANKS so much!
I do not think that the expression at 11:04 example is correct. It would match any number with or without full stops and dashes.
If you were to use the expression on this 123456789131, it would apply to this too. When it should not!
CDA Tech provides training and job placement assistance across a variety of careers. Contact us today to learn about the CDA Advantage.
Looking for a new career? Youve come to the right place.
Air Mixed Gas Commercial Diver Maritime Welding EMT DMT Our Programs.
*Underwater Welding Training at CDA Tech.
ROOM AND BOARD FOR MILITARY VETS.
CDA is proud to honor our vets. Thats why well waive both your registration fee and room and board when you attend CDA Technical Institute.*
*Restrictions apply, call for details.
After a successful career in the Army as an Army Ranger and Special Forces Combat Diver, CDA Technical Institute not only gave me a second-to-none education but they gave me the tools to be a successful, internationally-certified commercial diver! With CDAs education, the right attitude and the right work ethic you will be successful in this field!
Byron Beplay, AMGCD Program.
CDA Tech goes way past anyone’s expectations of a trade school. From the very first day this staff will be with you step-for-step making sure you feel exactly like family and helping you to succeed. I loved this school and everyone here. So take it from me: Come join the CDA Tech commercial diving family and be a part of this awesome industry!
Trey Lancaster, AMGCD Program.
I went to a trade school and got my welding certification and that was not enough. I found CDA technical Institute online and decided to become a Commercial Diver because of my love for the water. I had the best time going through CDA Technical Institute and I would definitely recommend this school to anyone looking for a career in Commercial Diving.
Brett Lamb, AMGCD Program.