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

  • @Nerdthagoras
    @Nerdthagoras8 жыл бұрын

    Man I love your energy and bubbliness.

  • @jayhey2577

    @jayhey2577

    6 жыл бұрын

    I need weed

  • @Amuntsen

    @Amuntsen

    3 жыл бұрын

    Ahaha, especially when he just like that gave up his email adresses so cute 💖

  • @asdasddas100
    @asdasddas1008 жыл бұрын

    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

    @TodRobbins

    7 жыл бұрын

    Same

  • @011azr
    @011azr6 жыл бұрын

    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.

  • @user-oy8bs9xx3b
    @user-oy8bs9xx3b2 ай бұрын

    Goodness this finally makes sense, I have been bouncing off regular expressions for ages. Thank you!

  • @TheBasmatiRice
    @TheBasmatiRice4 жыл бұрын

    Honestly makes me wonder why I'm even paying for tuition when I have access to this type of material. Cheers.

  • @franciscomoren0

    @franciscomoren0

    4 жыл бұрын

    Me too. LOL

  • @johnkhachian8254

    @johnkhachian8254

    4 жыл бұрын

    Plus, Daniel uses his videos as material for some of his NYU courses, so you're literally getting free college material

  • @zerosandones701

    @zerosandones701

    3 жыл бұрын

    A: There is no reason

  • @valor36az
    @valor36az Жыл бұрын

    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.

  • @mohammadkhanafer4847
    @mohammadkhanafer48472 жыл бұрын

    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!

  • @franciscomoren0
    @franciscomoren04 жыл бұрын

    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.

  • @vishal345able
    @vishal345able6 жыл бұрын

    Amazing tutorial.. the way you explain the things... outstanding.. full of energy... thank you very much....

  • @mindaugasmaslauskas1213
    @mindaugasmaslauskas12135 жыл бұрын

    At first I hated your videos, but now I like them. Good work!

  • @palmsenglish
    @palmsenglish6 жыл бұрын

    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!

  • @sudhanshusharma9123
    @sudhanshusharma91234 жыл бұрын

    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.

  • @mr.yanlucena8463
    @mr.yanlucena84637 жыл бұрын

    The best professor I know so far... What an energy!

  • @andresgalvez696
    @andresgalvez6964 жыл бұрын

    I just love the way you teach. Thank you for being that enthusiastic

  • @m7amedk
    @m7amedk4 жыл бұрын

    Thank you 🙏 I feel so much confiedent with regex now, its a great tool to learn and practice. Great vibes!! as always

  • @HamiltonFilmsNYC
    @HamiltonFilmsNYC6 жыл бұрын

    It just keeps getting better. Thank you

  • @RenanBorges
    @RenanBorges6 жыл бұрын

    thank you so much to teach me regex, i had had lot of questions, but now i'm enlightened but your explanations

  • @adarshnamdev5834
    @adarshnamdev58343 жыл бұрын

    Thanks for making such WONDERFUL videos Daniel, really loved the way you teach with this incredible and captivating Energy!!! God Bless You!

  • @heksqer1022
    @heksqer10225 жыл бұрын

    this was really helpful , thanks a lot for doing all of this for free Daniel !

  • @emiroygur9663
    @emiroygur96637 жыл бұрын

    I really appreciate your help in resolving my problem!

  • @krasimirkraev8716
    @krasimirkraev87164 жыл бұрын

    Thank you for this great explanations of RegEx!

  • @AndyWicks
    @AndyWicks5 жыл бұрын

    These videos are excellent - clear, positive and helpful. Well done (and thank you). :-)

  • @sandyjameslord
    @sandyjameslord5 жыл бұрын

    Thanks for your help, Daniel!

  • @codedynamics1
    @codedynamics12 жыл бұрын

    Excellent series. Thanks Shifty 🤭

  • @doaashafik3073
    @doaashafik30736 жыл бұрын

    your explanation is perfect awesome

  • @brijkishorsingh174
    @brijkishorsingh1745 жыл бұрын

    Best explanation I have ever seen

  • @christiandingwell4455
    @christiandingwell44556 жыл бұрын

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

  • @hdm_vision
    @hdm_vision5 жыл бұрын

    My Best Regex teacher

  • @hossamyasser2866
    @hossamyasser28666 жыл бұрын

    best regix explanation

  • @ask4applewho842

    @ask4applewho842

    4 жыл бұрын

    one can say regixplanation

  • @laurentinoquiroga2029
    @laurentinoquiroga20296 жыл бұрын

    Excellent, thanks so much !!!

  • @natikrak
    @natikrak4 жыл бұрын

    Thank you! You helped me a lot.

  • @craigruchman7007
    @craigruchman70077 жыл бұрын

    Thanks man, you are a great help

  • @RobertMcHalffey
    @RobertMcHalffey5 жыл бұрын

    Dude. You're so dope. Keep it up.

  • @maxverbinnen
    @maxverbinnen3 жыл бұрын

    Very helpful!

  • @gyd67ckn
    @gyd67ckn6 жыл бұрын

    Awesome video, thankyou.

  • @vijayalakshmi6028
    @vijayalakshmi60286 жыл бұрын

    loved your videos and your eneerrgy

  • @sauravsingh136
    @sauravsingh1365 жыл бұрын

    Your videos are awesome.

  • @ZGGuesswho
    @ZGGuesswho6 жыл бұрын

    dan the man with those solid learnin tips

  • @mrlolman6312
    @mrlolman63126 жыл бұрын

    Lot of love from me Daniel.Tnx Man

  • @folloem561
    @folloem5616 жыл бұрын

    another great video!

  • @domemvs
    @domemvs6 жыл бұрын

    Thank you so much!

  • @TheBleset
    @TheBleset5 жыл бұрын

    Awesome video

  • @tc536890
    @tc5368907 жыл бұрын

    How are there only 9 comments, this video is great!

  • @Amitkumarthakur
    @Amitkumarthakur7 жыл бұрын

    hey i am from india. thank you very much man, you are superb

  • @mclama_amine3724
    @mclama_amine37245 жыл бұрын

    thank you very much .you are better

  • @thelifeofmoom5794
    @thelifeofmoom57944 жыл бұрын

    I love this guy

  • @pikmin4000
    @pikmin40008 жыл бұрын

    nice video!

  • @haivernicolasaguileragomez7801
    @haivernicolasaguileragomez78014 жыл бұрын

    Thank you, new sub

  • @austinethridge2771
    @austinethridge27714 жыл бұрын

    "Now im gonna get a bunch of emails. Maybe i should spell my name wrong... eehhh never mind its fine" hahaha

  • @kalyanchakravarthy7904
    @kalyanchakravarthy79044 жыл бұрын

    Boy! Regex is such a boring topic, u made it absolutely interesting and easy. Wot an energy

  • @OTE887
    @OTE8872 жыл бұрын

    King among coders

  • @hussainsalih9736
    @hussainsalih97365 жыл бұрын

    Thanks my teacher

  • @toomajkarimi1980
    @toomajkarimi19805 жыл бұрын

    Much appreciated

  • @ahmad-ali14
    @ahmad-ali144 жыл бұрын

    you are the best.

  • @gahlyogu4570
    @gahlyogu45705 жыл бұрын

    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"?

  • @kareng9484
    @kareng9484 Жыл бұрын

    you are the best

  • @sumanverma-zw2rp
    @sumanverma-zw2rp3 жыл бұрын

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

  • @IamFrancoisDillinger
    @IamFrancoisDillinger7 жыл бұрын

    How many people found their way here as they're working through the FreeCodeCamp algorithms?

  • @AdamSchelenbergCom

    @AdamSchelenbergCom

    6 жыл бұрын

    Me. I'm doing a palindrome challenge and need be brush up on regex.

  • @IamFrancoisDillinger

    @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

    @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

    @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

    @grasshopperweb

    6 жыл бұрын

    I got here after a poor explanation from HackRank 30 days of code

  • @hossamyasser2866
    @hossamyasser28666 жыл бұрын

    افضل شرح لل ريجكس

  • @justinstar9710
    @justinstar97107 жыл бұрын

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

  • @ramiyer6810
    @ramiyer68107 жыл бұрын

    Is there any way we can have some logic that allows a ')' on the fourth place only if the phone number begins with a '(' ?

  • @MoreonTech
    @MoreonTech5 жыл бұрын

    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

    @kataya5005

    3 жыл бұрын

    or .+@

  • @tanh8285
    @tanh82857 жыл бұрын

    Cooooool

  • @Furze2
    @Furze26 жыл бұрын

    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

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

  • @123IGRACH
    @123IGRACH2 жыл бұрын

    You should make it (?:pat|pat) if you want to use it just for grouping and not for capturing.

  • @dingoprairie
    @dingoprairie6 жыл бұрын

    "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?

  • @xReTuneSx
    @xReTuneSx3 жыл бұрын

    You are so nice

  • @rivalino
    @rivalino7 жыл бұрын

    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

    @chetasdas2911

    7 жыл бұрын

    Because, neither always nor reachable contain any of the characters [abc], 3 times in a row

  • @elmartarverdili1246
    @elmartarverdili12465 жыл бұрын

    Thank you very much, but it will be great if you are more organised)

  • @estousemcriatividadepraumnome
    @estousemcriatividadepraumnome2 жыл бұрын

    I just now noticed Adam isn't someone, it's the text editor.

  • @TehSpeedRunner
    @TehSpeedRunner Жыл бұрын

    10:30 hot single capital letters ready to match in your area!!

  • @mohsenvafa
    @mohsenvafa5 жыл бұрын

    Your passion about regrx turn my hate regex to love regex

  • @MediaCoastline
    @MediaCoastline6 жыл бұрын

    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

    @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

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

  • @ainederrick8948
    @ainederrick89484 жыл бұрын

    100th comment. that's true. But I'm wondering what took me long to find this channel

  • @aaronargottelopez3488
    @aaronargottelopez34884 жыл бұрын

  • @pessimistkai5569
    @pessimistkai55696 жыл бұрын

    What does \b actually do?

  • @GaivotaCapoeira

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

  • @beaverjoe9171
    @beaverjoe91716 жыл бұрын

    The last solution is crazy complicate when i first met him

  • @efeskaachtzehn5153
    @efeskaachtzehn51532 жыл бұрын

    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)

  • @harriselliott9409
    @harriselliott94096 жыл бұрын

    Is the editor called Atom?

  • @TheCodingTrain

    @TheCodingTrain

    6 жыл бұрын

    Yes! For more: kzread.info/dash/bejne/eo5oppWwdLXHlcY.html kzread.info/dash/bejne/lmeDxaieqMifec4.html

  • @beberage
    @beberage7 жыл бұрын

    Why weren't you my professor in college?

  • @SuperCacazinho
    @SuperCacazinho4 жыл бұрын

    parei em 6:30

  • @flanker53
    @flanker536 жыл бұрын

    1:12 is going to be meme

  • @jaredbecker3152
    @jaredbecker31526 жыл бұрын

    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

  • @hiveminddestroyer51
    @hiveminddestroyer51 Жыл бұрын

    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* ?

  • @tonisun4785
    @tonisun47854 жыл бұрын

    you cute

  • @manvendrasingh1439
    @manvendrasingh14397 жыл бұрын

    Awesome video