Learn to Program 15 : Regular Expression Tutorial

[ad_1]
Code & Transcript :

Best Regular Expression Book :

Best Python Book :

Interactive Tutorial with Quiz Here :

Support me on Patreon :

In this video I start teaching about Regular Expressions. Regular expressions allow you to locate and change strings in very powerful ways. The awesome thing about them is they work in almost exactly the same way in every programming language. We’ll learn to match strings, return all matches, and use ., [ ], [^ ], compile, substitute, d, D, w, W, s, S, +, { }, and much more.

If you missed any of the previous videos, the series starts here :

Thank you to Patreon supports like the following for helping me make this video

@kyleaisho
@thetwistedhat
vjFaLk


Posted

in

by

Tags:

Comments

35 responses to “Learn to Program 15 : Regular Expression Tutorial”

  1. Nicholas Benzoni Avatar

    Hi Derek,

    when i compile your find email code, with the string ".+-%_" not included, it runs exactly the same (will still find email addresses to be valid if they have those chars)

    I had a strange issue w my code before trying yours

  2. Sam Viena Avatar

    Currently enrolled in architecture class and trying to learn programming, Idk if this is healthy for me lol. this is too much for my brain to handle haha

  3. Parafian12 Avatar

    hmm,
    that doesn't work exactly how you say,
    f.e.
    in
    if re.search("d{5}", "12345"):
    print("It is a zip code")
    if we put 6 numbers the sentence will be still printed.
    How I need to change the code that condition will be printed only if there are 5 digits?

  4. Balla Baby Avatar

    I ended this series after the threading video as I got lost and now it turns out I may need regex in the bot I'm making. I'm back for me. Goodie!

  5. mudit goyal Avatar

    did not understood curley{} braces 🙁

  6. Bilal Y Avatar

    Thank you so much for these videos! They are really helpful.

  7. jiexi zhao Avatar

    hi,Derek Banas,can you do a java spring framework tutorial…

  8. the1med Avatar

    sorry meant to put this comment on this module (15) :
    Hi Derek, in your last exercise to check how many valid email addresses,
    you will notice that db@aol.commm will also work and count. so it looks
    like the range {2,3} you put after [a-zA] only work for the first
    argument (ie 2) so it will force the string to have 2 characters but it
    ignores the second argument (ie 3). so how would you enfore that after
    the final "." you really have only 2 or 3 characters (.us or .com and
    not something like .comedu ?
    just FYI, I am using PyCharm on windows

  9. the1med Avatar

    just FYI regarding previous comment, I am using PyCharm for windows

  10. sumant kanala Avatar

    Great tutorials about regex. I'd like to thank you for making these wonderful tutorials about python and other languages. Your work is awesome!

  11. lehman maynite Avatar

    Your work makes me aspire Derek. Your everyone's hero.

  12. Jirka Michalík Avatar

    Hi dude, can you explain me how re.compile works? I've read documentation but I didn't catch that :/

  13. Logan Sinclair Avatar

    Hey, Derek! I just wanted to say how glad I am that you make these videos! Every time I have a problem in almost any language and I search for the answer, I always come up with your videos. You are a very good teacher that I am very thankful for. Thanks for making these videos and helping newbies like me! : )

  14. cerd man Avatar

    you sound like andy from the office

  15. Sergei Polishsuk Avatar

    More problems per video would be great.

  16. Adrian Stobbe Avatar

    @Derek Banas You committed an error in your solution 😉 You taught us to search for periods using . but you forgot the backslash. Another thing that is still buggy:
    It also excepts domains like ".co.uk" which shouldn't be allowed according to your requirements.
    My best way was adding this "^.*"

  17. praneta mahawar Avatar

    Which Mac computer do you have ?

  18. catonalake Avatar

    love your videos!

  19. Michael Devenport Avatar

    TARS Derek another fantastic tutorial – Michael. Check out my latest work @ https://twitter.com/WEBrip 😉

  20. Kristian Turner Avatar

    Nice videoes! A little heads up. This string will be picked up by your pattern in the end. "foo@bar-net". i believe you meant "." instead of "."

  21. goo gle Avatar

    Please do Vuejs tutorial sir.The Javascript framework looks so fun

  22. Oğuzhan Mangır Avatar

    Thank you Derek. I know a little English but I am developing myself throught your videos:)

  23. Lumbinian Avatar

    nice tutorials man..awesome…can you help out with cordova??

  24. Chupachu Avatar

    You should do a directx tutorial

  25. Hunter Johnson Avatar

    Awesome!!! this cleared up the few mistakes I usually make when using Reg. Expr's. 🙂 Great job Derek!!! Your page is the best lol Whatcha got planned for the next tutorial?

  26. Tasos Paunov Avatar

    Hy derek do you think about Vulcan API it is the future or we will still stick with opengl

  27. Milko Zlatev Avatar

    How did you get that layout in your IDE

  28. Eric Lundin Avatar

    Are you going to do any GUI tutorials? Love the videos!

  29. Simon K Avatar

    Great tutorial as usual. Could you maybe tie it together in some example projects?
    Also do you plan on doing some Raspberry Pi tutorials? Ideally something regarding smart homes. There is a lot of them online, but yours always seem better and easier to unterstand.

    Thanks!

  30. Matthias Fechner Avatar

    Thanks Derek for this really nice video.
    I think the last regexp for email in not correct. To match the last . should you not use .?

  31. GANGSTERLEONE Avatar

    derek do you have a facebook account…

Leave a Reply

Your email address will not be published. Required fields are marked *