Learn to Program 18 Regular Expression Tutorial 4

preview_player
Показать описание


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.

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

@kyleaisho
@thetwistedhat
vjFaLk
Рекомендации по теме
Комментарии
Автор

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.

draakisback
Автор

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.

saramsha
Автор

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..

madhavinori
Автор

+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.

terraflops
Автор

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

madhavinori
Автор

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

jakeroosenbloom
Автор

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

Brandonvideos
Автор

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 =

mikecase
Автор

great series on programming and reg exp. well done

masoud
Автор

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?

parki
Автор

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

wsteve
Автор

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).

kennyPAGC
Автор

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!

Teamer
Автор

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

foxyreptile
Автор

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

TheWantedBoysX
Автор

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

darshan
Автор

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

pranetamahawar
Автор

please make more videos about using python. like making chat program or sth.. I'd appreciate it

uglydailymeal
Автор

Could you explain to me what is a raw string ?

pranetamahawar
Автор

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

Gabemeister