Learn to Program 18 Regular Expression Tutorial 4

[ad_1]
Code & Transcript :

Interactive Tutorial with Quiz Here :

Best Python Book :

Support me on Patreon :

In this part of my Learn to Program series I finish my coverage of Regular Expressions. We’ll look at Or, Group, Named Groups, More Match Object Functions and then we’ll solve some problems.

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

40 responses to “Learn to Program 18 Regular Expression Tutorial 4”

  1. darshan darshu Avatar

    through above prog i didn't get the clear difference between look behind and negative look behind.
    could you please help me

  2. mudit goyal Avatar

    Sir One question–> I tried
    randStr = "7th May 2010"
    reg = r"^(?P<date>d+)w+s(?P<month>w+)s(P<year>d+)$"
    matches = re.search(reg, randStr)
    print(matches.groups())
    <Error>::: None type object is returned.
    What I am doing wrong over here

  3. Keshav Chand Avatar

    Sir I have a question,
    when will you cover networking in python

  4. Thanasis Euthimiou Avatar

    Thank you Derek for an absolutely lovely series on Python.
    I have one question though. I would love to practice more on the concepts of your videos, by solving problems.
    Do you have any websites with problems that you can recommend?
    Thank you very much!

  5. Madhavi Nori Avatar

    You do the regexp so effortlessly Derek, hope we learn that too..

  6. Madhavi Nori Avatar

    Also for the last problem of extracting the phone numbers in different formats, why did we have to look for d{4} twice at the end that is (d{4}|d{4}) and also in the middle of the expression for the closing parentheses you entered ")" twice in the video I think..

  7. Saramsha Dotel Avatar

    This was a great RegEx series. Well constructed. At first, I just tried to grasp the concepts through the book but all I could see was gibberish symbols. Now, after your tutorial, I have found my way with regex.

  8. praneta mahawar Avatar

    Could you explain to me what is a raw string ?

  9. praneta mahawar Avatar

    How did you think and create the formula to find the value of a Fibonacci number with only it's position ?

  10. E Dax Avatar

    +Derek Banas when searching why regular expressions matter (because it does not seem too appealing) I found out that it is a contentious issue, I watched the first 2 regex videos but can't see myself using them and but glad I know about them.

  11. Abdulnaser Sheikh Avatar

    Can I have the link to the regex cheat sheet?

  12. Anurodh Tripathi Avatar

    hey derek, can you do a lecture series on data structure in some specific language.

  13. Brandonvideos51 Avatar

    You should teach Batch. I know it is Windows exclusive and it is not popular but it is great for absolute beginners!

  14. Pandora's Box Avatar

    Derek, you should definitely do a Linux tutorial.

  15. readysetfire 7 Avatar

    Well hello internet!

  16. kennyPAGC Avatar

    why does the end of the phone numbers pattern have a (d{4}|d{4})? Why an "or" of the same exact thing?

  17. kennyPAGC Avatar

    Matching email addresses can be so complicated… I have seen huge chunks to fit almost all cases but still can't cover all of them. For example, the regex used in this video accepts addresses like email@example.12 or +@-.. and obviously these are not valid. What a nightmare for people who work with regex 😀

  18. kennyPAGC Avatar

    For problem 1 I came up with this pattern: "d{5}(-d{4})?s", however since I need to use the parentheses to say that the whole dash and 4 numbers are optional, that's capturing the group and that's what's being output when displaying the match. How can I output the whole match (without wrapping the whole pattern in parentheses).

  19. Daniel Jordanov Avatar

    YO derek can you do an update on xml?

  20. Kyle Davies Avatar

    Could you you cover data scraping with Python?

  21. Reziik Avatar

    Once this python series is done, can you do the same thing for C++? Your "learn in one video" for C++ is a bit fast for me, so if you could do a series like this, that'd be great ^_^ When you're done this one, of course.

  22. Gabemeister1201 Avatar

    You should totally do Cobol/Visual Cobol in 1 video, that would be so cool!

  23. Dragos Podaru Avatar

    Hello Derek, 10 / 10 tutorials as always.

    I have one question.. are you planning on doing a longer series like this one on react ?

  24. Sandunil Jayasinghe Avatar

    Hey Derek! Thanks a lot for these great work! Would you be able to do a lesson on JavaCC ( Java Compiler Compiler ) anytime soon? It would be a great support! 🙂

  25. Mr.4x3 Avatar

    so are your tutorials

  26. Mr.4x3 Avatar

    python is great

  27. The Wanted Boys Avatar

    derek in python you can do r"text" and in c++ L"text" what are those L and r how you define your own

  28. Steven Wang Avatar

    what happened to the last 4 digit of the telephone number in the last exercise?

  29. Mike Case Avatar

    Derek, great video, as always. I noticed a small issue with the first problem and thought it would be helpful to post a modified problem and solution. (Please let me know if there is anything that I got wrong.)

    The posted solution for the zip code problem works over the given dataset but might run into an issue if given different data.

    For example:
    randStr = "12345 12345-1234 1234 12346-333 12347"

    The last zip code isn't picked up by the regular expression because it doesn't match the "5 digits and a space" pattern (i.e. "d{5}s").

    One solution is to test for "5 digits and either a space or the end of expression" (i.e. "d{5}(?=s|$)"). This expression uses the look ahead operator (i.e. "(?= )") to check for, but not capture, the character immediately following a group of 5 digits. The complete expression is:
    regex = re.compile(r"d{5}-d{4}|d{5}(?=s|$)")

  30. Jake Roosenbloom Avatar

    How many more videos do you think is gonna take for this amazing series to be over?

  31. Parki Avatar

    Is there any focus group?
    I mean some people you give the tutorial before you upload it on youtube to check for mistakes you could make or you just expect it to be good enough to upload and just do it?

  32. Masoud Rousta Avatar

    great series on programming and reg exp. well done

  33. Kartheyan Sivalingam Avatar

    Can you cover coroutine functions, id() function, super() function, hash() and other built-in functions, metaclasses and more magic methods for customizing classes like _getattribute_, _slots_. You should also cover important concepts like mutability of objects in Python.

  34. Aayush Dani Avatar

    Are you planning do to different kind of videos in the future? 🙂

  35. Petros Dawit Avatar

    thank you for the vid

  36. FoxyReptile Avatar

    Nice tutorial as always. Any suggestions on using python to create Windows GUI binaries?

  37. RC CARS NATION Avatar

    if i learn this will it help me with my future career in cybersecurity

  38. Abeltensor Avatar

    so glad that you continue to make these videos Derek. Though I definitely don't need to learn how to program, from the ones that I have watched, this is a fantastic way of learning the main ideas behind building programs.

Leave a Reply

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