2.4: Regular Expressions: Capturing Groups - Programming with Text

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 ก.พ. 2025

ความคิดเห็น • 202

  • @s8x.
    @s8x. 10 หลายเดือนก่อน +5

    7 years later and so helpful. Thank U! Life ur enthusiasm when u teach. Makes listening and learning so much better. Wish there was more teachers like u

    • @pritam_rout
      @pritam_rout 10 หลายเดือนก่อน

      Indeed, I was about to comment same things.

  • @TheChodex
    @TheChodex 6 ปีที่แล้ว +130

    I feel like i got some kind of superpower now when i learned these regular expressions. Oh boy ladies are gonna be all over me when i show them my new editor skills.. :D

    • @damarh
      @damarh 4 ปีที่แล้ว +1

      boy ladies ? how was Pataya :p ?

    • @Alex-rt7de
      @Alex-rt7de 4 ปีที่แล้ว

      So your next level of your superpower is to write regular expressions for regular expressions search xD

    • @agurzil1424
      @agurzil1424 3 ปีที่แล้ว

      I am sure you are willing to say "Oh Ladyboys" ?

  • @johnn4314
    @johnn4314 6 ปีที่แล้ว +15

    you are literally one of the best teachers Ive ever seen. I consider myself a decent teacher, and I watch many others. but you have a natural ability to make things straight forward

  • @arguy337
    @arguy337 8 ปีที่แล้ว +56

    You are a freakin' hero. I've been having such a difficult time with regex, but your videos simplified them and actually made them something I can appreciate. Thanks!!

  • @saktibiswal6445
    @saktibiswal6445 2 ปีที่แล้ว +5

    I'm 5 years late for this video but the explanation is just WOOOOOW!! Awesome! I'm gonna keep this in my library.

  • @DJvonP
    @DJvonP ปีที่แล้ว +1

    Thanks alot!! Was googeling around for at least half an hour, still being confused afterwards. This made me understand capturing groups in 6min. And you have a great enthusiastic vibe!

  • @besmudgereport3717
    @besmudgereport3717 6 ปีที่แล้ว +3

    Never stop making regEx videos! I’ve learned more from you from three videos than I have from a 6 month bootcamp. Thank you, you are amazing and make learning freakin’ awesome. You might also be making rainbows safe for everyone again.

  • @GrubenM
    @GrubenM 7 ปีที่แล้ว +1

    No other online resource is excited about regular expressions; this is what makes this video excellent

    • @TheCodingTrain
      @TheCodingTrain  7 ปีที่แล้ว

      Regular expressions are my favorite!

  • @MSuriyaPrakaashJL
    @MSuriyaPrakaashJL 2 ปีที่แล้ว +2

    You are a great teacher. I didnt understand grouping that well. Now I kind of like regular expressions. I am having goosebumps

  • @siyingli8454
    @siyingli8454 2 ปีที่แล้ว +1

    Literally the best regex video I ever found! The instruction on coding platform is explained so badly but this one is amazing! The examples are so easy to be understood.

  • @philipdebrah9231
    @philipdebrah9231 9 หลายเดือนก่อน

    This makes understanding capturing groups so intuitive. Thanks

  • @azurtem-com
    @azurtem-com 4 หลายเดือนก่อน

    Sorry for spamming all your email addresses (humorously); which eight years later must all have been disabled/updated.
    I have to admit that your course on regular expressions is the first that has made sense to me. Thank you.
    I can now look forward to using my new structured understanding the next time I need to use a Regex.
    As a teacher, your enthusiasm, openness and humour make these videos easy and pleasant to follow.
    No more cringing, no more head scratching (well, maybe a little, here and there :]] ). I feel prepared; all thanks to you. Kudos.
    Take care and stay safe

  • @codewriter3000
    @codewriter3000 4 ปีที่แล้ว

    I've never seen somebody so enthusiastic to lecture on capture groups

  • @trabpukcip1177
    @trabpukcip1177 8 ปีที่แล้ว +1

    Ahh! I'm so glad you made a video on REGEX. Now I'm confident I will finally be able to wrap my head around this powerful language. Thank you Daniel, you're one hell of a great teacher :D

    • @trabpukcip1177
      @trabpukcip1177 8 ปีที่แล้ว +1

      I just noticed this is part of a Series. Even better!

  • @HamiltonFilmsNYC
    @HamiltonFilmsNYC 6 ปีที่แล้ว +7

    You have decoded the most cryptic part of JavaScript and freed me of my fear
    of running into regex in the wild one day and not knowing how to handle them confidently.
    Thank You

  • @alehunter15
    @alehunter15 6 ปีที่แล้ว +1

    What can you say for this guy?
    Literally have been trying to make a reg expression for a string, blank space and comma and not only I did it NO "stackoverflow copy-pasting code" but, actually chilled back, watched a couple of vids and understood what I was doing.
    Excellent series dude.

    • @kandysman86
      @kandysman86 6 ปีที่แล้ว

      He made me feel the same way. Was able to solve a problem at free code camp in one line, when the advanced solution provided took 4. Made me feel real good lol

  • @jadhavmayur135
    @jadhavmayur135 6 ปีที่แล้ว +3

    11:04 oh wow. This is what I was looking for the past hour. Making .* into non greedy. Thanks for these awesome videos. :)

  • @chandrakant6283
    @chandrakant6283 3 ปีที่แล้ว

    Can't thank you enough. This video right here just cleared all my confusion regarding backreference & sub_groups.

  • @allezzthepunk
    @allezzthepunk 4 ปีที่แล้ว +1

    This is the best regex series on youtube, love your energy also

  • @dembashow
    @dembashow 3 ปีที่แล้ว

    This man's energy is just incredible, Oh my god I wish every teacher was like him, thank you man

  • @joelchacon9278
    @joelchacon9278 3 ปีที่แล้ว

    Your energy is something else. Good stuff man!

  • @ahmadjauharhilmy8806
    @ahmadjauharhilmy8806 7 ปีที่แล้ว +14

    thank you, great explanation as always
    and at 12:51 i think it's better to put "\" after ")" instead of deleting it

    • @ronidey7100
      @ronidey7100 5 ปีที่แล้ว

      If you watch that part again you would realize that he deleted that backslash because of a misunderstanding.

  • @triathlon.75
    @triathlon.75 7 ปีที่แล้ว +1

    Thank you so much. I didn't know how to use the replace function. Now I get it thanks to this tutorial. Very well explained. My thorough gratefulness.

  • @ZGGuesswho
    @ZGGuesswho 6 ปีที่แล้ว

    Seriously the best videos on regex around.

  • @franct1984
    @franct1984 2 ปีที่แล้ว

    This is the first time I get here, but I have to say you're damn great! You made this part of regEx clear and simple. Thank you so much, mate. Regards from Spain!

  • @NIKHILJAIN
    @NIKHILJAIN 4 ปีที่แล้ว

    Your teaching style is awesome

  • @mkc0321
    @mkc0321 6 ปีที่แล้ว +1

    how can u explain such a complex things so joyful ...amazing

  • @s8x.
    @s8x. 10 หลายเดือนก่อน

    man the power i just gained from learning this😂 I’m going to be unstoppable

  • @AsaTaylor
    @AsaTaylor 8 ปีที่แล้ว

    Thanks you. I've made due by googling every once in a while when I needed a regex, but it's good to have a clear and friendly break down with examples.

  • @elishambadi3345
    @elishambadi3345 2 ปีที่แล้ว

    Absolute help. Helped me through a new regex project

  • @ludwigderinger
    @ludwigderinger 7 ปีที่แล้ว +1

    Thank you so much for the videos about regex and your perfect explanations! I tried to understand regex by reading tutorials for so long, but obviously I am too stupid. Now, thanks to your videos, I basically understand this mysterious regex stuff, especially this greedy thing. Your videos are so great and also funny! Thank you!

  • @Aggon88
    @Aggon88 6 ปีที่แล้ว +1

    You are a legend man. Great spirit waiving at us with positive energy and knowledge!!

  • @victorvillacis6764
    @victorvillacis6764 3 ปีที่แล้ว

    THIS IS AWESOME!!!! I've been searching and asking for a solution to my problem and this solved it

  • @rotrose7531
    @rotrose7531 4 ปีที่แล้ว

    As always, I am amazed by your super enlightening tutorials, thank you for making these great tutorials for us!!

  • @franciscomoren0
    @franciscomoren0 4 ปีที่แล้ว

    You did it again. Man, I love your explanations. Awesome

  • @filipebanzoli902
    @filipebanzoli902 5 ปีที่แล้ว

    Soo good! You have passion and simplicity to transmit your ideas, and this is so great! thanks for sharing your knowledge!!

  • @TheJamon06
    @TheJamon06 2 ปีที่แล้ว

    Thank you!!!!! I had not understood this topic, but now I do and all thanks to you

  • @Mikeanddrea
    @Mikeanddrea 8 ปีที่แล้ว +19

    The transition at 13:15 was hilarious. hahaha

    • @alexrogers1137
      @alexrogers1137 6 ปีที่แล้ว

      I think of all the times he mentions editing the video, but doesn't. Then I see this. What the heck kinda goofy thing did he think was actually necessary to edit out? LOL

    • @hypebeastambeen5099
      @hypebeastambeen5099 5 ปีที่แล้ว

      Yeah right :D

  • @ErickWendelAcademy
    @ErickWendelAcademy 4 ปีที่แล้ว

    Great class mate!

  • @bean_TM
    @bean_TM 4 ปีที่แล้ว

    dude... these are better than thenewboston videos. SUPER helpful.

  • @shyamsundar-wb9wn
    @shyamsundar-wb9wn 3 ปีที่แล้ว

    Thank you Sir for your Regex series. Well explained

  • @krispymallows
    @krispymallows 7 ปีที่แล้ว

    I've learned a lot from you master. but this video is the most useful so far

  • @rabatindominik
    @rabatindominik 6 ปีที่แล้ว

    You are chaotic Bob Ross of programming :)

  • @igor972
    @igor972 6 ปีที่แล้ว +2

    Thank you Daniel. You are my hero!

  • @ragtop63
    @ragtop63 6 ปีที่แล้ว +2

    Dash inside of character class can be first or last, just not between any two other characters. This comes in handy when you want to match a ] inside the class since that character MUST be first (or escaped) in order to be valid. In that case something like []().-] (match right bracket, open paren, close paren, dot and dash) is valid.

  • @MoT-MasterOfThings
    @MoT-MasterOfThings 7 ปีที่แล้ว +1

    Very helpful, and like the way you explained it in atom editor which is most used editor

  • @vigneshprabakaran9590
    @vigneshprabakaran9590 3 ปีที่แล้ว

    Can't thank you enough sir...for this piece of gold

  • @onlinecomedyclub5725
    @onlinecomedyclub5725 3 ปีที่แล้ว +1

    If Tim and Eric did a coding tutorial series, the ending title would like this.

  • @Duplex_Mismatch
    @Duplex_Mismatch หลายเดือนก่อน

    "full expression is group 0", i heard that and it made me understand the groups idea

  • @maceo2
    @maceo2 6 ปีที่แล้ว

    Thanks for breaking this down, this an excellent explanation.

  • @kilovolt2494
    @kilovolt2494 4 ปีที่แล้ว

    Regex is like a black belt in martial arts figiting against dirty datasets.

  • @erickcampos50
    @erickcampos50 6 ปีที่แล้ว

    You're a great teacher! Congrats!

  • @mcnidday
    @mcnidday 6 ปีที่แล้ว

    You are the best....I could give you a hug right now!!

  • @LibraryOfTheOligarchs
    @LibraryOfTheOligarchs ปีที่แล้ว

    Appreciate you! This made things much easier

  • @kleem1
    @kleem1 5 ปีที่แล้ว

    all of the scenarios are worth going through!!!!!!!

  • @alienglad
    @alienglad 5 ปีที่แล้ว

    Sir you are brilliant and I love your content!

  • @Alex-rt7de
    @Alex-rt7de 4 ปีที่แล้ว

    Oh, I wish there was such a teacher in my university.. or at least I wish I found you a little earlier

  • @MrVipulLal
    @MrVipulLal 3 ปีที่แล้ว

    Great video. Clear elaination. Thanks

  • @foucault9978
    @foucault9978 3 ปีที่แล้ว

    You are a legend. So helpful

  • @salehshekari1005
    @salehshekari1005 2 ปีที่แล้ว

    You explained it very well. Thanks dude

  • @lucianoinso
    @lucianoinso 3 ปีที่แล้ว

    Really clear, thank you so much! Always had some irrational fear to regex now I'm loving them, I'm gonna use them everywhere lmao!
    Exercise at 6:34 would be:
    re: (\(?)(\d{3})([-.)])\d{3}([-.])\d{4}
    replace: $1$2$3XXX$4XXXX

  • @deepdishseo
    @deepdishseo 2 ปีที่แล้ว

    Brother, you are amazing. Thank you.

  • @pranaysingh3147
    @pranaysingh3147 6 ปีที่แล้ว

    really awsme man............really watched ur videos nd subscribed ................thnks for making this awsme series

  • @palashsharma7652
    @palashsharma7652 6 ปีที่แล้ว

    Just another great video...
    Awesome explaination

  • @haraldurkarlsson1147
    @haraldurkarlsson1147 4 ปีที่แล้ว

    This is quite helpful! Thanks.

  • @kyawswaaung87
    @kyawswaaung87 6 ปีที่แล้ว +1

    I love ur teaching style... :D

  • @ryukikuga7460
    @ryukikuga7460 5 ปีที่แล้ว

    Great video! Keep it up!

  • @mustafawael8617
    @mustafawael8617 5 ปีที่แล้ว

    WoW, You are awesome
    Keep going on that way

  • @CloudWalkBeta
    @CloudWalkBeta 8 ปีที่แล้ว

    This is pretty cool, i was looking to make a chat app using canvas and a sprite font sheet,,, knowing regular expressions oughta help overcome the funny hurdles i was giving myself!

  • @vijayd15
    @vijayd15 4 ปีที่แล้ว

    terrific videos!

  • @avatads438
    @avatads438 7 ปีที่แล้ว

    You are a super great teacher!!!!

  • @BotDesigner
    @BotDesigner 5 ปีที่แล้ว

    I love your lessons!!

  • @ianngoh842
    @ianngoh842 ปีที่แล้ว

    thank you !!!! i needed this!!!!

  • @HipNerd
    @HipNerd 6 ปีที่แล้ว +11

    Don't know if Jenny appreciates having her number up there. ;-)

  • @emilianosalomonrojaspena1381
    @emilianosalomonrojaspena1381 4 ปีที่แล้ว

    You are a freaking genius

  • @Kirtonberg2
    @Kirtonberg2 6 ปีที่แล้ว

    So helpful. Thank you for sharing!

  • @abhi739
    @abhi739 3 ปีที่แล้ว

    awesome thank you for your wonderful explanation

  • @andresrosero8896
    @andresrosero8896 3 ปีที่แล้ว

    You are the best! Thanks!

  • @saurabhvaidya3721
    @saurabhvaidya3721 6 ปีที่แล้ว

    Cool vid! NYU Rocks!!!

  • @soldadopreciso
    @soldadopreciso 4 ปีที่แล้ว

    Thanks pal. Greetings fro Ecuador.

  • @hyeonsikgong8341
    @hyeonsikgong8341 6 ปีที่แล้ว

    I have a question. Is there any difference between \[(.*?)\]\((http.*?)\) and \[(.*?)]\((http.*?)\) at 13:00? I don't know why there is no escape character before closed bracket ']'. I want to know the difference b/w the one with or without escape character before ']'

  • @rohanpatil7746
    @rohanpatil7746 6 ปีที่แล้ว

    Amazing video.

  • @nadiapranabudi1749
    @nadiapranabudi1749 7 ปีที่แล้ว

    This helped me so much. Thank you!

  • @abhim9955
    @abhim9955 7 ปีที่แล้ว

    nice tutorials, thanks coding train

  • @JohnDoe-rk7ex
    @JohnDoe-rk7ex 6 ปีที่แล้ว

    Awesome video!

  • @nadirivers8640
    @nadirivers8640 6 ปีที่แล้ว

    Finally I've understood! Thank you :3

  • @s.g.753
    @s.g.753 2 ปีที่แล้ว

    awesome bhai

  • @flyh21c
    @flyh21c 7 ปีที่แล้ว

    You are really great. Really. Thank you.

  • @josephojebode8160
    @josephojebode8160 2 ปีที่แล้ว

    Dear Coding Train, Please what is the name of the application you used in this video for the regex explanation

  • @rudyNok
    @rudyNok 5 ปีที่แล้ว

    Why did the greedy .* stop at the end of the line on the [test]? Is this the default behaviour that the linebreak does stop greedy quantifier?

  • @Sanatani-answers
    @Sanatani-answers 10 หลายเดือนก่อน

    Great video.. thank you

  • @hypebeastambeen5099
    @hypebeastambeen5099 5 ปีที่แล้ว

    Thx for the help!

  • @KhalilYasser
    @KhalilYasser 6 ปีที่แล้ว

    Amazing videos. You are awesome

  • @simanchalpatnaik2566
    @simanchalpatnaik2566 5 ปีที่แล้ว

    Thanks for the excellent videos.
    Does these Regex codes will be applicable for Mainframe applications ?

  • @damarh
    @damarh 4 ปีที่แล้ว

    Hello thanks. by this point i am lost :) i was fiddling around in Notepad++ but had to get Atom for this and it did what i wanted .
    granted i did not write any fancy regex but i did write 2 by LOUDLY saying what i want and it worked :D
    wrote these 3 nuggets :)
    Step 1
    )

  • @MunamYousuf
    @MunamYousuf 7 ปีที่แล้ว

    Helped a lot.

  • @ishoobhardwaj9720
    @ishoobhardwaj9720 5 ปีที่แล้ว +1

    can you plz explain how adding ? in regex: \[.*\] helped in solving the prob.
    i mean \[.*?\] is still finding any character with 0 or 1 occurance which includes ']' as well.

    • @psbjr
      @psbjr 5 ปีที่แล้ว

      the ? modifier makes the match lazy, meaning it will do the match in as few characters as possible.

  • @rahuls331
    @rahuls331 5 ปีที่แล้ว

    Hi Coding Train! Again a great video on Regex. I have found out that empty parentheses matches every character. What's the use of the empty parentheses?

  • @enggpranjal
    @enggpranjal 4 ปีที่แล้ว

    Why the dash has to be first followed by the dot, i know it was throwing error but can someone explain the reason. @ 4:36

  • @Liggliluff
    @Liggliluff 4 ปีที่แล้ว +1

    Capturing groups are amazing, so I can go:
    /([01]?[0-9])\/([0-3][0-9])\/([12][0-9]{3})/
    And replace with "$3-$1-$2"
    Convert American date format to ISO format
    The code is a bit lazily written, but will capture dates from 00/00/1000 to 19/39/2999. So it will capture some invalid dates, but not most of them.