2.3: Regular Expressions: Character Classes - Programming with Text
In this video, I explain character classes which are a way of matching a selection of characters in a regular expression.
This is the third video in a series on Regular Expressions, which is part of the "Programming from A to Z" course at ITP (itp.nyu.edu).
Next Video: • 2.4: Regular Expressio...
shiffman.net/a2z/regex/
Course url: shiffman.net/a2z/
Support this channel on Patreon: / codingtrain
Send me your questions and coding challenges!: github.com/CodingTrain/Rainbo...
Contact: / shiffman
GitHub Repo with all the info for Programming from A to Z: github.com/shiffman/A2Z-F16
Links discussed in this video:
MDN's Regular Expressions Reference: developer.mozilla.org/en/docs...
Regular Expressions on Wikipedia: en.wikipedia.org/wiki/Regular...
Book Mastering Regular Expressions: shop.oreilly.com/product/97805...
ITP from Tisch School of the Arts: tisch.nyu.edu/itp
Source Code for the all Video Lessons: github.com/CodingTrain/Rainbo...
p5.js: p5js.org/
Processing: processing.org
For More Programming from A to Z videos: kzread.info...
For More Coding Challenges: • Coding Challenges
Help us caption & translate this video!
amara.org/v/VsLE/
📄 Code of Conduct: github.com/CodingTrain/Code-o...
Пікірлер: 118
Man I love your energy and bubbliness.
@jayhey2577
6 жыл бұрын
I need weed
@Amuntsen
3 жыл бұрын
Ahaha, especially when he just like that gave up his email adresses so cute 💖
Been struggling with regex for a long time but after your first video literally everything fell in place and I stayed up until 3 making random regexs. Thanks man your videos really help.
@TodRobbins
7 жыл бұрын
Same
I don't know why but I keep smiling at how you act, not to mention that rainbow thing in the background. So fabulous xD.
Goodness this finally makes sense, I have been bouncing off regular expressions for ages. Thank you!
Honestly makes me wonder why I'm even paying for tuition when I have access to this type of material. Cheers.
@franciscomoren0
4 жыл бұрын
Me too. LOL
@johnkhachian8254
4 жыл бұрын
Plus, Daniel uses his videos as material for some of his NYU courses, so you're literally getting free college material
@zerosandones701
3 жыл бұрын
A: There is no reason
My first thought when I got it "I have the power!!!". Thank you so much, you saved me so much time editing my PhD on LaTEX.
i absolutely hate anything related to computer but since my engineering program imposes a couple of programming courses i had to learn it, but man the way you explain is extremely enjoyable that you changed my perspective about Coding and i actually did enjoy it. Thanks a lot!
Your explanation about regex are the best explanations EVER. Pleasant, to the point, well structured without any unnecessary complexities right off the bat. You are the best. Thx.
Amazing tutorial.. the way you explain the things... outstanding.. full of energy... thank you very much....
At first I hated your videos, but now I like them. Good work!
Daniel. Love the videos! I started reading Friedl's book, it is great. But, you cover the main topics in such an easy to understand and fun way. Thanks so much!
I was really very confused with the regex stuff for the last couple of days and wasn't able to implement it anywhere. Your video cleared this concept in a very systematic way and I like your humorous way of teaching a lot. It's like feeling relieved and laughing at the same time.
The best professor I know so far... What an energy!
I just love the way you teach. Thank you for being that enthusiastic
Thank you 🙏 I feel so much confiedent with regex now, its a great tool to learn and practice. Great vibes!! as always
It just keeps getting better. Thank you
thank you so much to teach me regex, i had had lot of questions, but now i'm enlightened but your explanations
Thanks for making such WONDERFUL videos Daniel, really loved the way you teach with this incredible and captivating Energy!!! God Bless You!
this was really helpful , thanks a lot for doing all of this for free Daniel !
I really appreciate your help in resolving my problem!
Thank you for this great explanations of RegEx!
These videos are excellent - clear, positive and helpful. Well done (and thank you). :-)
Thanks for your help, Daniel!
Excellent series. Thanks Shifty 🤭
your explanation is perfect awesome
Best explanation I have ever seen
I don't know if you know but you are hilarious in a very good way. I would love to be in the same office as you =)
My Best Regex teacher
best regix explanation
@ask4applewho842
4 жыл бұрын
one can say regixplanation
Excellent, thanks so much !!!
Thank you! You helped me a lot.
Thanks man, you are a great help
Dude. You're so dope. Keep it up.
Very helpful!
Awesome video, thankyou.
loved your videos and your eneerrgy
Your videos are awesome.
dan the man with those solid learnin tips
Lot of love from me Daniel.Tnx Man
another great video!
Thank you so much!
Awesome video
How are there only 9 comments, this video is great!
hey i am from india. thank you very much man, you are superb
thank you very much .you are better
I love this guy
nice video!
Thank you, new sub
"Now im gonna get a bunch of emails. Maybe i should spell my name wrong... eehhh never mind its fine" hahaha
Boy! Regex is such a boring topic, u made it absolutely interesting and easy. Wot an energy
King among coders
Thanks my teacher
Much appreciated
you are the best.
I think the phone number regex would allow *(123.123-1234* or *(123-123-1234* How would you say "IFF theres a open parenthesis then there must be a parenthesis in after the third digit"?
you are the best
i have started learning Regular expressions and came accross this video...great session ..thank you so much....one quick question though, the window that we are seeing where you are typing ?could you please share the link so that i can also start practising :)
How many people found their way here as they're working through the FreeCodeCamp algorithms?
@AdamSchelenbergCom
6 жыл бұрын
Me. I'm doing a palindrome challenge and need be brush up on regex.
@IamFrancoisDillinger
6 жыл бұрын
I didn't finished all of the advanced ones, took a break and doing some Udemy courses. I hate algorithms but love the feeling when all the tests to pass. I could never tell if they were actually hard or I was just horrible at doing them.
@AdamSchelenbergCom
6 жыл бұрын
you know what helps me is watching the Graham Hutton videos. For example, kzread.info/dash/bejne/opd-qs2Qp820nJc.html If all algorithms were explained in a similar way that would have been really awesome.
@IamFrancoisDillinger
6 жыл бұрын
Interesting way to look at it, seems like he'd be a cool professor to have. I'll probably end up buying a book or two on using algos in JS, I know they aren't really a major concern for jr devs but I'd love to get to a point where I can breeze through them. There's a course on udemy I did by a guy named Eric Traub. There are tons of resources for algos in Java and other languages, but his course is on JS and helped a good bit though you could probably find similar videos on youtube.
@grasshopperweb
6 жыл бұрын
I got here after a poor explanation from HackRank 30 days of code
افضل شرح لل ريجكس
+The Coding Train 13:08 You can also have dotted email domain, eg, daniel.shiffman@nyu.faculty.edu or daniel.shiffman@nyu.business.admin.edu How would you fix that?
Is there any way we can have some logic that allows a ')' on the fourth place only if the phone number begins with a '(' ?
Hi Daniel thanks for this series of Regex,I learnT them in my college but I had tough time understanding them and I had no Idea how would I use them but now I find them so interesting and useful thanks a lot, and I think at 12:58 it would be wrong to add [\w.]+ at the beginning because this would also accept emails beginning with one or more dots e.g ..@sdfsd.dsfdsf how about this regex [\w]+(_|.|\w)[\w]+@[\w]+.(in|edu|com|org|ac|net)
@kataya5005
3 жыл бұрын
or .+@
Cooooool
Great videos, just learning about regex and this is a very helpful video. At 8:26 why does [^abc]{3} not match the 'num', 'n ', 'reh' or 'lw' in the words numbers, can , reachable and always? If the regex is meant to match anything that is not 'abc'? Is it because they must not be abc in lengths of 3 characters?
@oo7moses
5 жыл бұрын
Yes, it must be in lengths of 3 characters. The "{3}" at the end means it searches for "not a, b, or c" in 3 consecutive character places. And the "n" in "number" is already taken in a matching search result (spaces are a match, remember). Search results will not overlap as he mentioned in an earlier video, so next it checks the next 3 characters after the "e n" match. There is a "b" in "umb" so it doesn't match and continues checking for more matches after that.
You should make it (?:pat|pat) if you want to use it just for grouping and not for capturing.
"Not" 0-5 doesn't make sense.. it's leaving dashes, dots, 6's and 7's in there. I'm not understanding how it's choosing a "not" abc either. please further clarify [\w .] (escaped w in brackets means any number of characters?
You are so nice
Sempai, when you wrote [^abc]{3}, which means any char but a,b,c. STILL matched other letters that come after c, why's that? like the word "always" and "reachable"
@chetasdas2911
7 жыл бұрын
Because, neither always nor reachable contain any of the characters [abc], 3 times in a row
Thank you very much, but it will be great if you are more organised)
I just now noticed Adam isn't someone, it's the text editor.
10:30 hot single capital letters ready to match in your area!!
Your passion about regrx turn my hate regex to love regex
8:30 what i'm seeing here confuses me. I'd expect everything except a, b, or c to be highlighted, but almost the entire word "reachable" is omitted. Can someone explain?
@ThanhSonNguyen0211
6 жыл бұрын
Sam Macaluso it’s a little late, but note that the regex was [^abc]{3}, so only sequences that have no 3 a, b, or c IN A ROW are highlighted. Take a look at Reachable and you will see what I mean
@MediaCoastline
6 жыл бұрын
Am I understanding this right? It is highlighting any sequence of 3 characters that does not include a, b, or c? Once it highlights a sequence, the selector moves on to the next character after the selected portion, leading to what I perceived as seemingly weird behavior? This would explain why a is not always the first character in its chunk, but sometimes the second or third. Thank you.
100th comment. that's true. But I'm wondering what took me long to find this channel
What does \b actually do?
@GaivotaCapoeira
6 жыл бұрын
Following the python documentation: \b is word boundary. This is a zero-width assertion that matches only at the beginning or end of a word. A word is defined as a sequence of alphanumeric characters, so the end of a word is indicated by whitespace or a non-alphanumeric character.
The last solution is crazy complicate when i first met him
other tutorials on KZread: If you want to select this, write this. tutorials on this channel: Daniel: UHHH hmmm how could we solve that problem? me thinking: Yeah that is a good question, how could I solve this? Daniel: What if I told you there is a brilliant solution (hitting a cringe soundfx button)
Is the editor called Atom?
@TheCodingTrain
6 жыл бұрын
Yes! For more: kzread.info/dash/bejne/eo5oppWwdLXHlcY.html kzread.info/dash/bejne/lmeDxaieqMifec4.html
Why weren't you my professor in college?
parei em 6:30
1:12 is going to be meme
If you want to test your regex use regexr.com/ It breaks up the entire expression and explains what each section does. Its very helpful especially when starting out
How tf is calling these expressions "regular" sensible given they don't follow their own pattern of *meta characters are appended to backslashes and literals aren't* ?
you cute
Awesome video