Python Tutorial: re Module - How to Write and Match Regular Expressions (Regex)

  Рет қаралды 1,139,097

Corey Schafer

Corey Schafer

Күн бұрын

Пікірлер: 1 200
@vishwa4908
@vishwa4908 7 жыл бұрын
Corey, Your way of teaching is impeccable.
@arveycozza9820
@arveycozza9820 6 жыл бұрын
*Your
@omarkhan5223
@omarkhan5223 6 жыл бұрын
*teaching is
@ITSMIAS
@ITSMIAS 6 жыл бұрын
@@omarkhan5223 cheers mate thanks for fixing his fucking English now Corey can properly understand his compliment
@felixospina1268
@felixospina1268 4 жыл бұрын
H
@MayankSingh-wd6zq
@MayankSingh-wd6zq 3 жыл бұрын
Hey, is this whole python tutorial is good for data science??? I mean do we need all this topics to get started with data science, plz tell me i m begginer.
@sarithsn
@sarithsn 3 жыл бұрын
Personal timestamps for second, third ..nth viewings: 0:00 - What are regular expressions. 0:52 - Re module and example intro. 1:28 - Raw string in Python 2:29 - Simple examples using re.compile and finditer 5:29 - Escaping special characters with a backslash 7:04 - Use regex to search for patterns. Use of meta-characters. 10:21 - Metacharacters continued. Anchors. Word boundaries. 12:04 - Anchors continued. ^ and $ 13:55 - Practical examples. Matching phone numbers of patterns 123-456-7890 or 123.456.7890 18:58 - Precise matching using character-set 20:24- Character-set only matches one character in the set 21:27 - Match specific numbers. (800,900 phone numbers) 22:57 - Role of dash(-) within a character set. Used to specify ranges. 24:16 - Role of carets (^) within a character set. Used to negate. 25:50 - Use of quantifiers to match more than one character at once. 31:20 - Groups. Match several different patterns 33:08 - Recap of previous concepts with examples. Matching email addresses 36:56- Deciphering existing regular expressions. 39:05 - Capturing information from groups. The group method in the match object 44:07 - Back reference to reference the captured group. Sub method to perform substitution 46:35 - findall method. Just returns the matches as a list of strings 47:58 - match method. Matches at the beginning of string. 49:30 - search method. Search the entire string. 50:08 - flags . Examples: ignorecase, multiline, verbose
@Jack-jq9vl
@Jack-jq9vl 3 жыл бұрын
Thank you so much these time stamps have saved me so much time
@ahmedifhaam2669
@ahmedifhaam2669 3 жыл бұрын
3 months ago when I saw this comment, I thought it was kinda dumb. now its my second, third, nth time going through this comment lmao
@pratyushupadhyaya7367
@pratyushupadhyaya7367 3 жыл бұрын
YOU ARE A REALLY GOOD MAN
@md.enamulhoq9389
@md.enamulhoq9389 3 жыл бұрын
how do we use underline( not underscore) in re python?
@spyderkavin
@spyderkavin 3 жыл бұрын
pin this comment
@PoliticalParodys
@PoliticalParodys Жыл бұрын
ChatGPT is recommending your videos when I type Create a 365 day plan for learning python including KZbin videos and links to reading materials and anything else that might help, make it work around my schedule, I work 5am-7pm Monday to Thursday.
@anyarobinson2334
@anyarobinson2334 Жыл бұрын
That's such a good idea. I'm now going to do that to make myself a selflearning lesson plan now.
@mightymaxglitches1548
@mightymaxglitches1548 5 жыл бұрын
Only good teachers prepare their lessons beforehand. This video is very informative, seamless, and so helpful
@stevensbrito7188
@stevensbrito7188 7 жыл бұрын
I really have to say that not everybody has that pedagogy you have and I really appreciate, or better said, WE really appreciate your time making those video tutorials. I always recommend you to everyone who wants to know python or even if they know already. I have learned a lot, but I always watch your videos to keep learning, even if I forgot some topics that I don't want to pass over. By another hand this the best video tutorial that I ever have seen about Regular Expressions. Thank you very much Corey.
@FreePalestine8096
@FreePalestine8096 7 жыл бұрын
My feelings exactly. Corey is an excellent teacher! So grateful for these videos :)
@patobrien2329
@patobrien2329 4 жыл бұрын
Well spoken, Stevens Brito !
@sadiqueahmed2693
@sadiqueahmed2693 2 жыл бұрын
This is the best regular expression teaching I have ever seen and believe it’s the best in the world. It covers almost everything in detail. Thank you Corey.
@mralirezaaaaa
@mralirezaaaaa 7 жыл бұрын
This was what I really wanted, i searched for python RE all over KZbin, but none of those videos were like this! thanks corey, you are the best ptython teacher :)
@coreyms
@coreyms 7 жыл бұрын
Thanks! I'm glad you found it helpful
@md.enamulhoq9389
@md.enamulhoq9389 3 жыл бұрын
@@coreyms how do we use underline( not underscore) in re python?
@mansouri9430
@mansouri9430 6 жыл бұрын
OMG. how can you be so fluent and focused in a 53min video? You're the ultimate teacher. Thank you
@clementlin3140
@clementlin3140 2 жыл бұрын
This is gold..... I'm a backend engineer with 2 yrs experience. And keep getting regex questions in job interviews recently... This tutorial concludes everything needed! Thank you so much Corey, I really appreciate it!
@kinwong6383
@kinwong6383 5 жыл бұрын
Amazing tutorial. I gave up watching my professor's video and came to this. This video needs to go viral!!
@swaantjuh
@swaantjuh 5 жыл бұрын
I was real sceptical about this video because I didn't think I would grasp this concept in less than an hour. But im only 16 minutes in and im already in love with regular expressions! Thanks for making this video, you really made my week!
@YoussufYasserAhmad
@YoussufYasserAhmad 3 ай бұрын
After almost SEVEN YEARS, This video is still the best video on youtube for regex explaination. Thanks for the beautiful content👏
@sirSuhrab
@sirSuhrab 6 жыл бұрын
Never ever in my life I had a better teacher than Corey! You are awesome!
@rishabkumar9578
@rishabkumar9578 4 жыл бұрын
My mind doesn't resist to learn python RE while Corey teaches. God bless you.
@MayankSingh-wd6zq
@MayankSingh-wd6zq 3 жыл бұрын
Hey, is this whole python tutorial is good for data science??? I mean do we need all this topics to get started with data science, plz tell me i m begginer.
@odetolaolaitan7557
@odetolaolaitan7557 5 жыл бұрын
You're by far the greatest teacher I've listened to on any subject matter. God bless you brother.
@madjayhawk
@madjayhawk 5 жыл бұрын
Brilliant work. This should be an example of how to teach anything on KZbin. Clear, concise, organized, and useful. When done, just ask yourself whether you now understand Regular Expressions. I am going to go try all this stuff out while it is fresh.
@2kpresident363
@2kpresident363 5 жыл бұрын
You're by far the best teacher I've ever seen on youtube. When I listen to your lesson, everything unclear to understand gets crystal-clear. I have to say you're a wizard of python-teaching. Thank you so much
@danielspector9280
@danielspector9280 3 жыл бұрын
I searched across the 7 seas of the internet. But I couldn't find any better tutorial in the internet. Cheers Corey
@yourev100
@yourev100 4 жыл бұрын
For the first time,, I have understood regular expression coz of this tutorial. And am going to contribute. Thank you so much
@S-w3c
@S-w3c 3 ай бұрын
I was daunted by the thought of learning Regexes before I bumped in to this video. Now they make so much more sense, more importantly - in a logical way. Thanks a lot, Mr. Schafer.
@theinfant
@theinfant 6 жыл бұрын
Man, you are an AMAZING teacher. I spent a whole lot of time trying to just be able to know how this worked, and I basically understood all of what you showed here, after watching this one video. thank you so much :)
@korkunctheterrible4302
@korkunctheterrible4302 2 жыл бұрын
I am someone who gets easily distracted by irritation and thanks to Corey's voice, tone, articulation and all, as well as his breaking down of subject matter, I am able to pay more attention than I normally can. Mentally active, yet very peaceful. Thank you. All the best to you.
@ivanabregu1
@ivanabregu1 4 жыл бұрын
The way Corey goes incrementing what he is teaching is amazing including this topic that is a pain in the ass. You can't realize when you are learning the hardest part cos Corey made us easy. Thanks a lot!
@لنتسقطامةرسولهامحمدوصاحبهعمرال
@لنتسقطامةرسولهامحمدوصاحبهعمرال 4 жыл бұрын
you are a genie......with your videos i got a job ..thanks thanks thanks........i was before website developer with php ...........thanks alot of ..you save my life ...god bless you
@plxiznogoud3328
@plxiznogoud3328 7 жыл бұрын
I watch lots of videos related to programming and so far I haven't seen anyone upload high quality material as consistently as you do. There's a lot of content out there nowadays but most just scratches the surface. Your videos live up to the famous quote by Einstein "Everything should be made as simple as possible, but not simpler". :)
@coreyms
@coreyms 7 жыл бұрын
Thank you! I appreciate that.
@landrobin24
@landrobin24 6 жыл бұрын
Reading this topic in the books was giving me a lot of headaches, but your video just made it a breeze to understand the concept of RegEx. Thanks a ton
@vijaypracash
@vijaypracash 5 жыл бұрын
Simply superb. Corey has converted a complex concept into an easy and simple with his excellent teaching skills. Thank you Corey!!
@lamski3286
@lamski3286 3 жыл бұрын
I have taken many paid courses on this topic and yet your free tutorial is the best so far, you were born to teach!
@EnglishRain
@EnglishRain 4 жыл бұрын
46:16 - if you're coming from the previous Regexp video, start from here to skip all the things already explained in the previous video. 43:00 - Start from here to see how groups are implemented in Python
@alice_hml
@alice_hml 4 жыл бұрын
Thanks!
@EnglishRain
@EnglishRain 4 жыл бұрын
@@alice_hml No sweat! :)
@Nekatho
@Nekatho 4 жыл бұрын
damn it, i just see this when i finish the video
@alfredsfutterkiste7534
@alfredsfutterkiste7534 3 жыл бұрын
thanks mate glad I scrolled down :) there's a part in there about reading file contents as well but that's rather obvious if you know how to read in files in python and use regex to parse their contents.
@panagiotisgoulas8539
@panagiotisgoulas8539 3 жыл бұрын
Actually watch the first 7 minutes on start and skip to 43:00
@meghasyam427
@meghasyam427 Жыл бұрын
I tried to learn regex many times but lack of basic understanding in the tutorials left me with no interest and quit. But telling you this has been the best in explaining each and everything clearly and now i'm so confident in applying the same. Thanks a lot corey. You are the best.
@mohammadrezakarimi2400
@mohammadrezakarimi2400 4 жыл бұрын
I was so scared about RegEx before this video... I have seen lot's of python videos over the internet (especially KZbin) and I can say you are the best and your tutorials are unique and awesome thanks a lot :)
@chokchaip
@chokchaip 19 күн бұрын
Previously, I've never understood on the Regex until I found your video. It make me more comfortable with Regex. Thank you for this valuable video.
@Krishna-zh3pw
@Krishna-zh3pw 6 жыл бұрын
Straight to the point means Corey Schafer tutorials.
@MayankSingh-wd6zq
@MayankSingh-wd6zq 3 жыл бұрын
Hey, is this whole python tutorial is good for data science??? I mean do we need all this topics to get started with data science, plz tell me i m begginer.
@hellospam879879
@hellospam879879 6 жыл бұрын
I too searched the internet without luck until I saw this video: this starts at step 1 and moves quickly forward - nice job Corey and thanks.
@preranajoshi8488
@preranajoshi8488 6 жыл бұрын
Thank you so much for the tutorial. Through this entire 1 hr session I felt like I know regex properly. Very confident with my regex skillls.
@yaz_ibra22
@yaz_ibra22 4 жыл бұрын
I thought I would never be able to understand what Regex is , until I found this video I don't know how to thank you enough but your way of explaining is priceless.
@killerpesty
@killerpesty 5 жыл бұрын
Corey, this is one of the best explanations of regex I have found. I have been trying to wrap my mind around this for a very long time. The way you break it down and explain it is exceptional.
@riasatmanzoor
@riasatmanzoor 4 жыл бұрын
Man! Ive avoided learning regex for many years just because it looked scary..Now I just learnt it here in an hour! Thanks a lot.
@rickyricardo75
@rickyricardo75 5 жыл бұрын
Fantastic job!!! I don't have a programming background but I understood every single piece of code. Much better than these guys in Coursera, EDX, etc !!
@AKIPATIYA
@AKIPATIYA 4 жыл бұрын
Sharing your knowledge with people is, above all, a highly meritorious act according to my religion.
@cjromb
@cjromb 4 жыл бұрын
I just found this video today, and watched the ENTIRE thing! Thank you thank you! It was absolutely fantastic.
@mukaddastaj5223
@mukaddastaj5223 Ай бұрын
I can say without any hesitation that everything about this video is perfect! The pace, the beforehand-prepared, organized examples and rules, the quality of sound and voice, even your pronunciation T_T thank you!
@abdulkarimabdulwahab7135
@abdulkarimabdulwahab7135 4 жыл бұрын
At some point, I thought to myself: is this really a free video or a paid course? RegEx had given me sleepless nights. Articles I'd read kept confusing me with various weird combinations. Until I found this video. I'm over delighted. Thanks a bunch. Now I'm pretty confident reading those articles of RegEx that caused me headaches before.😊😜😂
@anamitrasingha6362
@anamitrasingha6362 3 жыл бұрын
Thank you so so much for this video! I tried reading the docs but it confused me all over, I'm so thankful that your videos exist on youtube for free.
@BiancaAguglia
@BiancaAguglia 5 жыл бұрын
Thank you, Corey. I'm finally beginning to see the light at the end of the regex tunnel. 😀 Your video was a huge help.
@shubhamprakash1176
@shubhamprakash1176 4 жыл бұрын
The best regular expression tutorial I have seen till today. I just loved it.
@ultiumlabs4899
@ultiumlabs4899 6 жыл бұрын
this tutorial really gives enlightment to the regular expression topic, finally I think I understand about regex, I've tried to understand about regex but feel difficult before this video. your explanation is superb. Thanks Corey, really appreciate your tutorial.
@ponnuvel659
@ponnuvel659 4 жыл бұрын
one of the confusion topic in any scripting language is 'Regular expression' but you made it easy Thanks Corey.
@skhanal123
@skhanal123 5 жыл бұрын
I have watched multiple videos on regex but none of them like this. This is really really GOOD !!
@sandeepsingh-sp7yn
@sandeepsingh-sp7yn 4 жыл бұрын
I have seen many tutorials and blogs for regular expression but was not able to understand, But your way of teaching is super awesome it help me understand the complex regex expression very easily.... Really impeccable teaching.
@deepaksoni77460
@deepaksoni77460 Жыл бұрын
It was such a great tutorial. This was my first time learning Regex, and I didn't know you'll break it down this much simpler. Great explanation! Thanks a lot! ❤
@MoinKhan-cg8cu
@MoinKhan-cg8cu 4 жыл бұрын
Easiest and most effective Regx explanation i have ever seen.
@ryfepersonal
@ryfepersonal 5 жыл бұрын
BEST regex explanation I've ever watched. Thanks!
@Gregory-q7l
@Gregory-q7l Ай бұрын
Hey Corey, your tutorials rock! Thank you!
@minasmorgul6054
@minasmorgul6054 5 жыл бұрын
I'm 2 minutes in, and have learned more than in past 3 days. Keep on the good work!
@Yasharvl
@Yasharvl 4 жыл бұрын
Long live and prosper Corey! I watch your videos to understand the most difficult subjects that I fail to comprehend on other self-learning platforms.
@shyamlohar1996
@shyamlohar1996 7 жыл бұрын
Was searching for this *_* And I got notified that Corey uploaded new video on re module 😎 my search ends here. Liked before viewing it.
@domihamzala3624
@domihamzala3624 4 жыл бұрын
I don't often comment on any youtube video even if I like it but the teaching method in this video is outstanding !!!!!!!!
@Pillez0
@Pillez0 4 жыл бұрын
This is a masterpiece, you're the greatest teacher I've found on youtube Corey. Thank you very much!
@dragonking696
@dragonking696 5 жыл бұрын
I have used regex for a while but not in Python. Using re in python and trying to just display the match seemed like a chore to figure out. Finally found group(0) but was not sure what this was grouping. Your explanation in this video was so very helpful and gave me the info I was looking for. Thank you!
@NaachoElegante
@NaachoElegante 5 жыл бұрын
You are gem as a teacher, i wish i could learn the skill of teaching from you. Everything is just excellent. Regarding RegEx, i always skipped or hated to go through this topic but you made it hell lot of easy for all of us. Those who aren't aware of you, are actually missing out some good stuff. Thanks a ton for creating such videos with such precision, would request you to create some on DS and algorithms, it will be a big help for people like me :) who never understood complexity or Big O concepts :( just like RegEx.
@AmiNation5430
@AmiNation5430 2 жыл бұрын
The level of teaching is really astonishing. I could understand the concept very well.
@lenryan1985again
@lenryan1985again 5 жыл бұрын
Thanks very much for the video. I find your videos very helpful . I had started to give up on learning programming but you have made me want to stay at it. Thanks a million
@NeumsFor9
@NeumsFor9 2 жыл бұрын
Cory = King Of Progressive Disclosure. Others do it well, but not at the right speed and not at the intersection of of relevance and practicality.
@Abhinav-ui7rc
@Abhinav-ui7rc 6 жыл бұрын
I m keenly looking for advanced features video for Regex. You are the best teacher.
@kgautamkk
@kgautamkk 6 жыл бұрын
One of the best RegEx tutorials I have come across so far on the web. You made regex look so easy!!
@rockeyvalley
@rockeyvalley 5 жыл бұрын
Great video. i was clueless just trying to read about re on my own.
@YitzharVered
@YitzharVered Жыл бұрын
Amazingly useful. Never thought I'd see the day when a tutorial actually helped without directly disscussing my issue, but good god this one manages it. Amazing.
@dchandolia
@dchandolia 6 жыл бұрын
Best Tutorial on Regex
@suhailchougle7315
@suhailchougle7315 4 жыл бұрын
Searched for RE all over KZbin and none of the other videos are even close to this video,amazing bro Thank you so much really appreciate it
@amitbuch
@amitbuch 4 жыл бұрын
Best intro on Regex ever :-) Kudos.
@usernameofnik
@usernameofnik 2 жыл бұрын
I'm not gonna lie, this is the first programming channel I subscribed to for over an year. Excellent content. Thanks !
@yxngboypolo
@yxngboypolo 3 жыл бұрын
bro, I'm starting to realize that regex could've saved me so much time. All the coding spent using if states to make sure syntax was correct. I could cry
@JB-ik1yf
@JB-ik1yf 4 жыл бұрын
I commented on the other regex video you did, but last night and today I watched this video and again took really detailed notes. Today I was working on something where I had to strip off a bunch of characters and I thought, “you know what, I think I can just write a regular expression to do this instead of .strip().etcetc” So I wrote a pattern to match my string with re.compile(), then used var.sub(r’\groupnumberhere’), appended to a new list, and accomplished exactly what I needed to quickly and easily instead of having to .strip(), etc. I used to be so intimidated by this stuff; really can’t thank you enough!
@yomajo
@yomajo 4 жыл бұрын
This is incredible, but one thing is missing: when students come back for specific parts, timestamps would be invaluable!
@quyenscc
@quyenscc 2 жыл бұрын
Amazing!!! I have been struggling for days with learning material from my university and other document on the internet until I found your video. Thanks a lot. You are simply amazing with your style of teaching.
@yusufsalk1136
@yusufsalk1136 4 жыл бұрын
Absolutely! "It is pretty fu\w{5} powerful." 16:16
@sarahmusinde4327
@sarahmusinde4327 Жыл бұрын
Major props, Corey! This tutorial is hands down one of the best I've seen on regex in python. The clarity of your explanations made it a breeze to grasp a big thanks for sharing this knowledge.
@MsSuyash1995
@MsSuyash1995 5 жыл бұрын
Hands down, the best video on regular expressions on KZbin... I loved both of your videos on regular expressions...
@rakilachraf391
@rakilachraf391 5 жыл бұрын
thank you so much Mr Corey , from now on I'm considering you a very valuable asset :)
@walih8027
@walih8027 4 жыл бұрын
Friend let me tell you something, I usually cant stand long videos especially when it comes to programming. BUT MY LORD THIS WAS AN AMAZING TUTORIAL. THANK YOU. THIS IS 10/10 WORK RIGHT HERE.
@curiousbit9228
@curiousbit9228 5 жыл бұрын
Corey, You are My Rockstar Programmer!!!
@patobrien2329
@patobrien2329 4 жыл бұрын
Impeccable is the word for your way of teaching. You excel in the preparation and execution of your tutorial. None better !
@labiodnzm5733
@labiodnzm5733 4 жыл бұрын
one word to describe this : r'(wow)+'
@aka5
@aka5 4 жыл бұрын
wowwowwowwow
@aka5
@aka5 4 жыл бұрын
I prefer r'w(ow)+' ;-)
@ArikLikesWolves
@ArikLikesWolves 4 жыл бұрын
@@aka5 its all about the r'wo+w' :)
@MayankSingh-wd6zq
@MayankSingh-wd6zq 3 жыл бұрын
Hey, is this whole python tutorial is good for data science??? I mean do we need all this topics to get started with data science, plz tell me i m begginer.
@worldofmusic1058
@worldofmusic1058 3 жыл бұрын
@@MayankSingh-wd6zq yes it will definitely help, whole of the data science is in some way or other based on regex and OOP!
@ilaydasenyuz3561
@ilaydasenyuz3561 2 жыл бұрын
sentence = 'this was THE BEST regex tutorial I have watched!!!' pattern=re.compile(r'(the\sbest)', re.IGNORECASE) match = pattern.search(sentence) print('LITERALLY ' + str(match.group(0))) thx ^^
@psk_1998
@psk_1998 6 жыл бұрын
You need to be more famous
@amrita7444
@amrita7444 3 жыл бұрын
Corey, I am so grateful to you, you are the best. I wasted money to learn python, but your videos taught a lot more and easy to understand. Thanks a lot. I always recommend your videos to my friends.
@asad9377
@asad9377 4 жыл бұрын
Hi what will be the regular expression code if we want to extract the full names from the data.txt file
@jitttttt
@jitttttt 3 жыл бұрын
This is the best Regular Expressions tutorial video online ever.
@ravichandrank5182
@ravichandrank5182 7 жыл бұрын
Corey can you teach us django framework please
@arunsaivemula1300
@arunsaivemula1300 7 жыл бұрын
even i am waiting for his django tutorials... please corey do some videos on django framework
@ravichandrank5182
@ravichandrank5182 7 жыл бұрын
He is very good at teaching, I have never seen this much clear definition in explaining a concept better than Corey 🙏 thanks for your works ✌👍
@hultramann8107
@hultramann8107 7 жыл бұрын
Here is a free tutorial, kzbin.info/www/bejne/r3XZZnl_dsqspbs but Are Schafer's python videos enough-learning to later learn Try Django 1.11?
@obinnavitalis5972
@obinnavitalis5972 Жыл бұрын
Your videos are my first go-to on topics I found to be complex. Thank you Corey for these mind-blowing contents.
@utomocalvin
@utomocalvin 5 жыл бұрын
When matching email regex, why use '[a-zA-Z0-9-.]+' instead of '[\w-.]+' ?
@yosiasz
@yosiasz 4 ай бұрын
wow 7 years old, oldie but goodie, oh my goodness! not only was this fun, but also technically so sound it is still good. on top of that Corey has the patience and teaching skill that is rare with tech folks with deep technical know how. It helped me wrangle syslog files with inconsistent data with ease! I salute you sir! thanks so much!
@dimianovic7717
@dimianovic7717 4 жыл бұрын
Thank you so much! I love your way to teach! It's not to be taken for granted that so many people simply watch an hour of tutorial straight!
@RandomShowerThoughts
@RandomShowerThoughts 6 жыл бұрын
this man is the goat. I went from hating regular expressions to learning them after this video
@Jokeofdday
@Jokeofdday 4 жыл бұрын
one of the best video on python regex.. this is the first time i watched any youtube tutorial video for straight 55 mins... also immediately subscribed.. 👍 you are a great teacher.. and attention to every small details is hats off
@ToddsDiscGolf
@ToddsDiscGolf Жыл бұрын
This is the best regex tutorial I’ve ever seen. I can finally finish my assignment.
@markkennedy9767
@markkennedy9767 11 ай бұрын
I'm just reading about regex on Automate the Boring Stuff and this video has really helped make things easier to understand. Corey does a great job of showing why you might want to do something as well as how to then do it. Really good stuff
@datboi_gee
@datboi_gee 4 жыл бұрын
This is phenomenal. I've been working -- or rather TRYING to work -- on a project that requires complex string parsing and I've been hating my life. It's mostly my fault because I'm doing extra unnecessary work. I'm working on a competitive programming problem in which I'm expected to be given a tuple of strings, and within them I'm supposed to extrapolate specific data, convert and adjust values mathematically based on the composition of each string. The issue comes in with a personal dislike for writing what I feel is dirty code. By this I mean I've been given very clear constraints, and explicitly told that these strings will always be formatted in a particular way. And yet I feel dirty just hard-coding values based on the explicit format the string is guaranteed to arrive in. I wanted to build something far more comprehensive and flexible. Something that would identify the values and assign them not based on their position in the string, but rather based on their composition. While I do recognize I'm making this harder on myself than I have to, and that these extra details aren't at all necessary for the sake of completion, I'm thrilled to have come across regex. Because even if it's unnecessary in this current use case, something like this feels like an incredibly potent tool to have under your belt. I love it. Thank you for the video. Excellent work.
@ccs618
@ccs618 3 жыл бұрын
This is the best regex tutorial I’ve seen! I recommend this video to anyone that wants to learn regex.
Python Tutorial: Using Try/Except Blocks for Error Handling
10:34
Corey Schafer
Рет қаралды 712 М.
Regular Expressions (Regex) Tutorial: How to Match Any Pattern of Text
37:55
ТЫ В ДЕТСТВЕ КОГДА ВЫПАЛ ЗУБ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 4,6 МЛН
What type of pedestrian are you?😄 #tiktok #elsarca
00:28
Elsa Arca
Рет қаралды 34 МЛН
10 Important Python Concepts In 20 Minutes
18:49
Indently
Рет қаралды 307 М.
If __name__ == "__main__" for Python Developers
8:47
Python Simplified
Рет қаралды 414 М.
10 Python Tips and Tricks For Writing Better Code
39:21
Corey Schafer
Рет қаралды 1,3 МЛН
REGEX (REGULAR EXPRESSIONS) WITH EXAMPLES IN DETAIL | Regex Tutorial
10:43
Python Tutorial: File Objects - Reading and Writing to Files
24:33
Corey Schafer
Рет қаралды 1,8 МЛН
Regular Expressions in Python
18:58
NeuralNine
Рет қаралды 81 М.
Learn Python OOP in under 20 Minutes
18:32
Indently
Рет қаралды 109 М.
Learn Regular Expressions In 20 Minutes
20:52
Web Dev Simplified
Рет қаралды 1,3 МЛН