Old video, but in case anyone watches it, there are some mistakes: 1. std::smatch::size() does not return the number of matches! it returns the number of capture groups plus 1 for the whole match! The reason he gets 2 is because he put the whole string inside a capture group (round brackets). So one for the whole match, and one for the capture group. If he'd use another set of these brackets, he'd get 3. 2. std::smatch::str(1) does not return the first match! it returns the first capture group! 0 is the whole match, but because he put the whole string inside a capture group, using 0 would net him the same result as 1. 3. \w also matches an underscore (_), and naturally, underscore wouldn't be matched with \W (i.e. capital letter w). In general, using capturing groups (round brackets) is expensive and shouldn't be used if there's no point for it, and in this video there really wasn't a point. Even if you need to use parenthesis, you can disable capturing by adding ?: in the beginning. No disrespect to the author by the way! The video was decent overall!
@gigamungus57646 жыл бұрын
I have an interview coming up in a few days for c++ and a week ago i had never even looked at the language, you have no idea how grateful I am that you started making this when you did
@derekbanas6 жыл бұрын
Thank you :) I'm happy I could help. Best of luck on your interview
@abeerkh44932 жыл бұрын
Thank you so much for your hard work on your videos. I have learned more from you than my university doctors. The way you explain stuff in a very simple and straight forward way is AMAZINGGGG. I really appreciate your efforts. THANK YOUUUU
@derekbanas2 жыл бұрын
Thank you for taking the time to tell me I helped :) I'm very happy you are enjoying my videos
@vojar36926 жыл бұрын
Huge appreciation for your determination, free educational videos and effort to help everyone! Hope your 2019 is gonna be ++awesome! All the best!
@derekbanas6 жыл бұрын
Thank you very much :) I wish you all the best in the new year!
@justsurajp2 жыл бұрын
At 26:48, wouldn't the "." (dot) accept any character instead of period character? Would it be more meaningful to use "\\." instead to specify we are looking for a period and not just any character?
@gigamungus57646 жыл бұрын
in the final example you didn't escape the dot, so it was matching any character, not just "."
@derekbanas6 жыл бұрын
Whoops sorry for the typo. I wrote the code largely out of my head
@jonajo2613 жыл бұрын
I don't undestand, in PrintMacht2 you don't initialize lastMach wtf is going on ; how can you check for the value if lastMatch is empty
@samitkapoor534 жыл бұрын
at 26:50 wont we add another '\' before '.' to escape the '.' in reg14?
@Skooma150 Жыл бұрын
Thanks for this video. Been a while since I used regex and the syntax is very confusing, especially when you're rusty. Spent hours on stack and this is the first thing that helped me make any progress.
@sabrinanastasi5809 Жыл бұрын
Hands down the best regex tutorial, thank you!!!!
@exodus88146 жыл бұрын
This is wonderful :) Thank you very much Derek, you never fail to upload such high quality and clear videos, you are awesome! Thanks :)
@derekbanas6 жыл бұрын
Thank you for the nice compliment :) I try to do my best
@exodus88146 жыл бұрын
Derek Banas Wow thanks for the fast reply too :)
@feraudyh3 жыл бұрын
There's one thing I did not get: lastmatch is not set anywhere, so why should it represent the end?
@shawnarmstrong33392 жыл бұрын
I looked into this. The default constructor for sregex_iterator creates an end-of-sequence iterator; from the documentation : "The default-constructed std::regex_iterator is the end-of-sequence iterator. When a valid std::regex_iterator is incremented after reaching the last match (std::regex_search returns false), it becomes equal to the end-of-sequence iterator. Dereferencing or incrementing it further invokes undefined behavior."
@jamesday2386 Жыл бұрын
@@shawnarmstrong3339 life saver, thank you
@bryany32414 жыл бұрын
Don't you need to use double backslashes in c++ regex, to escape the escape character (the backslash)?
@nicklansbury31666 жыл бұрын
Derek, as always, another very informative tutorials. Thanks for that. I was wondering. Now that you've done a 'How to Make Video Games' series and you are currently doing a 'C++ Tutorial' series, would you consider combining the two subjects? I'd love to see a 'How to Make Video Games using C++' series. Just a thought.
@kesuskim60726 жыл бұрын
yeah, possibly using Unreal engine or SFML!
@nicklansbury31666 жыл бұрын
Actually I'd prefer to do something 100% in code rather than use a visual editor. There's already a ton of UE4 tutorials around. Getting down and dirty with the code is what interests me.
@derekbanas6 жыл бұрын
I'll see what I can do. I can make a basic graphics engine and if people watch it I'll continue making videos. I love covering complex topics, but they are a double edged sword. They are harder to make and then it is disheartening after I make one to see that only 20 people watched the whole video.
@derekbanas6 жыл бұрын
I'm working on a UE4 tutorial
@kesuskim60726 жыл бұрын
wow, making basic graphics engine!! :) very interesting derek, I'm very interested (y)
@muhsenalkhalidy78493 жыл бұрын
Hello , i included the regex library and when type std::smatch sm; the compiler gives error says that smatch is not a memeber of std? plz help
@MatthewBendyna Жыл бұрын
Does the carrot symbol still mean begins with in C++ like in Python and C# when not inside the brackets? (assuming brackets mean set)
@shreyshah42204 ай бұрын
Great video! Just use the "using namespace std" at the start! It is really off putting.
@MrinmoyHaloi2 жыл бұрын
i have a problem where i need to use the dotall flag. How can i do that in c++ ?
@Omar-dd2lw6 жыл бұрын
i study programming in college ,and cause of your videos i just got 60/60 (full mark) in C++ ,thank you so much
@derekbanas6 жыл бұрын
Awesome! Great Job :)
@MochrieTVHotS5 жыл бұрын
Fantastic video! :) The length is absolutely justified by the content.
@derekbanas5 жыл бұрын
Thank you very much :)
@russellmcnamara61076 жыл бұрын
Derek I am your biggest fan my name is Russ I have been in jail for a year and I could never stop thinking about you and your videos they're so amazing I couldn't stop about how you said hello Internet and everything about your videos and you I hope your doing good I love your videos so much
@bobhutchinson36385 жыл бұрын
Seems like you are okay for now!
@jakesmith68536 жыл бұрын
As usual, big thanks to you :). Preparing for a tech interview with the help of your videos. You rock!
@derekbanas6 жыл бұрын
Thank you very much :) I wish you the best of luck on your interview!
@ashleyrawr745 жыл бұрын
Hi, I'm trying to use the iterator but I'm getting a "regex_iterator not dereferencable" bug message in output. Any ideas on how to fix this?
@derekbanas5 жыл бұрын
I have working code in the description. Try comparing it to yours using diffnow.com
@limyautito32982 жыл бұрын
How can I use the regex library?
@gnujeu6 жыл бұрын
I just wanted to say I figured out the application... Your videos are very helpful
@derekbanas6 жыл бұрын
I'm happy I could help :)
@kholiyamails12572 жыл бұрын
there was the question by amazon related regular expression ........ if starting char match with last char (example : aba , ab , aa) aba and aa would be true and I was given only this line regex regular_expression("________________") ,and I only was to write inside it ,so what should be written inside it .🙂
@alonsamuel9346 жыл бұрын
Hi!! Thank you very much for the tutorial!! it helped me understand some basic ways to use regex in order to shorten my life in searching string stuff. :) I wanted to ask how did you use currentMatch? I thought that you would first declare it as an iterator and then fill it with data. I didn't see where did you put data in it... I also didn't understand how did you declare it with parenthesis ? If you could explain a bit more for me... thank you !!
@GeckoSharky6 жыл бұрын
"Any call to regex_match or regex_search with the match_results object as argument sets this value to true, even if the function does not succeed in finding any match." You sure that ready() indicates that there is a match or not? Doesn't sound like it according to the docs.
@derekbanas6 жыл бұрын
Thank you for pointing that out. I bungled my explanation. It returns true if the test for results is finished. I updated the code on my site.
@terrylim47255 жыл бұрын
Around the 17min mark of your video: Using: std::regex reg7 ("([^ ]\..\..\.)"); Gave this error: warning: unknown escape sequence: '\.' Changing the line to : std::regex reg7 ("([^ ]\\..\\..\\.)"); resolved the error, and the code could compile
@abderrazakschannel44912 жыл бұрын
how to do the apostrophe in regex?
@AdityaDodda6 жыл бұрын
In PrintMatches the number of matches seems to be incorrect. Try setting std:regex reg("(was)"); The number of matches evaluates to 2.
@samng11586 жыл бұрын
yeap, there is an error. not sure why might be the pattern
@NicoScholz905 жыл бұрын
makes me wonder as well. Anybody got a clue what exactly goes wrong here?
@exodus88146 жыл бұрын
Hey Derek! I have a suggestion, could you please think about doing compiler videos? That would be insane!
@derekbanas6 жыл бұрын
Compilers aren't really that complicated. You basically have to translate from one language to another. Making an optimized compiler is the hard part
@exodus88146 жыл бұрын
Derek Banas thank you very much for response, sorry if I asked too many questions. :)
@marianacsinlove4 жыл бұрын
There's no need to declare de functions printmatches??
@Sebastian-qc3gw3 жыл бұрын
Hi, thanks for the tutorial, helped me a lot! I think reg7 should be "([^ ]\\..\\..\\.)". In this particular case it works, but if str7 was "F.B.I. I.R.S. CIA F.B.I." the output doesn't meet the expectations.
@jacktolmie19713 жыл бұрын
Thanks. I was wondering why I was getting warnings. I was looking through the comments for an answer to this exact issue :).
@vnm_89456 жыл бұрын
Can I ask how many tutorials will be added to complete this C++ tutorial and when this is going to happen, some estimation?
@derekbanas6 жыл бұрын
Sorry I don't know. I'll continue making tutorials until I feel I've covered most everything
@vnm_89456 жыл бұрын
Ok, thank you, I'm interested in linked list, I will watch all the videos, but I don't think it's covered. I'm learning something new in every video, thank you for the effort.
@cerrillotorrescarlosivan54424 жыл бұрын
Muy buen video amigo, una duda, en el regex siempre se debe introducir la expresión a evaluar o hay alguna forma de hacer uso de regex pero que no se defina la expresión, si no que el usuario la introduzca?
@timothyleffel31866 жыл бұрын
thanks for making the internet a less icky place
@derekbanas6 жыл бұрын
I'm trying to do my best :)
@akagaming94316 жыл бұрын
Yeah, it's about goddamn time we have this tutorials haha :D I've been waiting for your C++ videos and it feels like ages, thanks for the tutorials Derek!
@derekbanas6 жыл бұрын
I'll do my best to get them out quicker. Work has been crazy lately. Maybe someday I can do this full time :)
@levhordiichuk66515 жыл бұрын
Hi, you used ' \. ' in F.B.I. ex. and said that if i want to search ' . ' i must use ' \. ' and then in 'homework' you did not use ' \. ' . Can you explain why? Or you just made a mistake? Thanks. P.S. tutorial is really helpful.
@shinwarivideos33564 жыл бұрын
sir I need this Odd length regular expression implementation in c++
@adamchalkley9566 жыл бұрын
I wouldn't call this a tutorial,because well it's not really,I would call it a refresher. You don't actually take time to explain whats going on instead you just write code assuming we already know what the function does,what it returns and how the functions you are using work.
@kedicat75 жыл бұрын
Functions are explained here kzbin.info/www/bejne/baGvnZecj9qhgKs it is 10 -15 chapter before. (I am not Derek's friend or something but ...he explains it very well here. )
@JoeGlines-Automator3 жыл бұрын
Regular Expressions rock! Thanks for this inspiring tutorial! I've made a few on it but enjoyed watching yours as well! :)
@derekbanas3 жыл бұрын
I'm very happy you liked it :) Thanks for taking the time to tell me
@larrybishop51396 жыл бұрын
Hey Derek great video. I just have another question though. In your long c++ tutorial i saw you use some type of syntax. Is it better to use getline or just the regular cin?
@derekbanas6 жыл бұрын
Thank you :) Sometimes you have to use getline, but often they are interchangeable. For example we are receiving input here std::cout
@larrybishop51396 жыл бұрын
Ok thank you.
@JustinK04 жыл бұрын
Nice, Right out of ch 17.3 in the c+ Primer textbook that i read right before this video! haha
@junfengwei88774 жыл бұрын
Hi,what is your ide? Vs code+clang
@_________________4044 жыл бұрын
He's using netbeans. But I don't think it's the best IDE to use, he just uses it because he's on a Mac.
@crystyxn6 жыл бұрын
Hey great vids on c++. How long will this series be ? Please make one about making your own C++ library soon! Or if you know any resources you could redirect me to thanks
@derekbanas6 жыл бұрын
I'm not certain. I covered how to include outside files here kzbin.info/www/bejne/r6ixi3Sbl8x4kNk
@2271masoud6 жыл бұрын
Thanks for the tutorial Derek. I wish I could upload the photo I took of the screen with your name on top saying the best channels on KZbin. it happened in the biggest javascript meetup here in London. Thanks for all your efforts
@derekbanas6 жыл бұрын
Wow that is amazing!!! Thank you for telling me :) I've personally never met anyone that has watched my videos. It is always nice to hear that they have helped
@Omar-dd2lw6 жыл бұрын
yaaaaay a c++ video , love you
@derekbanas6 жыл бұрын
I'm glad you liked it :)
@neerajsingh7696 жыл бұрын
Please upload some video on advance internet technologies and web security based on java , servelets, ejb etc. Including xml...thanx
@brodypaterson66956 жыл бұрын
Hey Derek, I’ve been watching your videos for a while now, and I would like to know if you’d be open to making a how to make a desktop computer series. I hope you see this. Thanks your a great KZbinr and I love your videos.
@derekbanas6 жыл бұрын
Thank you for the nice compliment :) That isn't really my area of expertise and I'm also pretty cheap. I normally buy everything refurbished and buy old models. My current computer is 5 years old.
@brodypaterson66956 жыл бұрын
Derek Banas ah ok thanks for the response.
@HellHappens6 жыл бұрын
The internet was made to have such great information spread! Do you think you could cover MTAs on Linux? It is the most confusingly documented software I've ever seen. Exim would be nice but honestly I just want some help setting up custom emails
@derekbanas6 жыл бұрын
Thank you :) Do you want a mail server?
@HellHappens6 жыл бұрын
Well it's a long story. I have an odd boss who wanted to set up his own business, email server included. He basically said figure it out and I knew next to nothing about linux. He was then convinced Qmail was the way to go and for 5 months we tried messing with it to no avail via our ineptitude. We switched OS's three times from an older version of fedora, to the newest, to CentOs. then went with Exim. Got it half running, ran into an ssl certificate error and could only send emails to ourself. It has been quite the en devour and basically no tutorials exist that don't expect you to have a decent background in running things. I've always been avoidant when it comes to asking for things because I find it rude, but I would LOVE absolutely love an exim centos tutorial or any Mta/mail server tutorials. So Much love ~R
@Rashaadthegr86 жыл бұрын
How do I use this in mac? Seems like the setup different then using virtual machine and visual studio.
@derekbanas6 жыл бұрын
I show how to install everything in this video kzbin.info/www/bejne/epLQpnhuibJmrtE
@exodus88146 жыл бұрын
Hello again Derek, (leaving a new comment instead of a reply to insure that you get this), I've seen a reply of yours stating that you would do a simple graphics engine, my question is do you prepare/study before making such complicated topics? Or do you write them out of your head? I would love to be like this, is it possible to reach that point?
@derekbanas6 жыл бұрын
I'd research to make sure there aren't better ways then I currently know. I'm nothing special. Anything I do anyone else can do. I can't stress that enough.
@exodus88146 жыл бұрын
Derek Banas Yes you are :) You're an inspiration and a very smart person Derek:) May God bless you and your family.
@derekbanas6 жыл бұрын
May God bless you and your family as well :)
@angadminhas72076 жыл бұрын
Can you do one for swift 4?
@derekbanas6 жыл бұрын
I'll see what I can do
@AbhiRadhikaDas3 ай бұрын
Thanks man!
@kedicat75 жыл бұрын
Thank you a lot, it is not easy to find good tutorials for c++ regex.
@derekbanas5 жыл бұрын
I'm happy I could help :)
@nikhiledu75566 жыл бұрын
I was little worried 😂 coz you didn't post for a while. Thanks✌️
@derekbanas6 жыл бұрын
Sorry for the wait. I was a little overwhelmed with work last week. I should be able to make a bunch of videos this week.
@theoathman81883 жыл бұрын
I have noticed that Regular Expressions are extremely slow and produce a massive assembly code. So if you can get away with it, please do.
@j0551165 жыл бұрын
Thank you very much! It helps me a lot.
@derekbanas5 жыл бұрын
I'm happy you found it useful 😁
@bruh-moment-215 жыл бұрын
very helpful! thank you!
@derekbanas5 жыл бұрын
Thank you :)
@joeflynt74803 жыл бұрын
Okay so I dont mean this in a mean way so I hope if he ever reads this he doesnt take it that way but this guy sounds like the head pixie from fairly oddparents to me
@derekbanas3 жыл бұрын
That's funny :)
@akj76 жыл бұрын
Thanks man.
@derekbanas6 жыл бұрын
Happy to help :)
@thebeginningk89446 жыл бұрын
Thank you very much
@derekbanas6 жыл бұрын
I'm very happy to be of help :)
@talha_coding_tutor4 ай бұрын
i used chat gpt for this std::regex singleOperandPattern(R"(^(\w+)\s+(-?\d+(\.\d+)?))"); std::regex doubleOperandPattern(R"(^(\w+)\s+(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?))"); can someone explain this to me !
@V1kToo3 жыл бұрын
Should have started with a very simple sentence instead of using a whole function.