Video Presentation: Regular Expressions, Extraordinary Power
Posted March 11, 2011 at 9:23 AM by Ben Nadel
I first learned how to use Regular Expressions (aka RegEx) about 6 or 7 years ago for the purposes of data cleaning. I would take massive Excel files, paste them into Macromedia Homesite, and then use the Find/Replace feature to strip out all the extra spaces, tabs, and commas. It was tedious work; but, I am tremendously thankful that I had to do it because learning Regular Expressions has more than paid for itself in terms of programming efficiency.
Frankly, Regular Expressions are amazing! They're almost magical. But, they are complex, which is why so many developers shy away from them. In this video presentation, I do my best to try and break down Regular Expressions into tiny, bite-sized components that you can much more easily wrap your head around. And, hopefully, by the end, you can start to see the kind of potential that Regular Expressions provide.
| || || || || |
| || |
| || || |
And, don't forget! International Regular Expression Day is June 1st! It's the 4th annual day of celebration in praise of powerful string manipulation! We'll be giving out fun prizes and just reveling in the awesome glow of Regular Expression goodness.
| || || || || |
| || |
| || || |
Stay tuned for more information on Regular Expression Day.
There is such a day? I guess I have 2 1/2 month to practice my regex skills before then . . .
First things first,
Ben Nadel is Awesome.
I have always been a bit wary and confused by the power and complexity of regular expressions.
Being at your talk at SOTR2011 - in typical fashion you broke it down into simple concepts and very quickly had me understanding it a lot better and in much greater depth.
Thanks for posting the slides and video!
Heck yeah there is :D
Thanks a lot - it's really nice to hear that this stuff came out a bit less intimidating than it might normally. The basic building blocks of regular expressions aren't too bad; it's that the combination of those building blocks can quickly get quite complex!
I liked the way you broke down the string and formed the regular expression. It made it easy to follow.
Thanks! I was hoping the step-wise approach would help clarify some stuff.
There is definitely some point when working with REGEX that it clicks. If you don't get to that point, then you are perpetually stuck trying to avoid them or mashing keys in a regex tester until it works but you don't know why (I've spent hours with yours, Ben).
I imagine many people are in that position above when it comes to hobbyist or part-time programmers. For me, it clicked when tackling a really complex reg-ex. I had to use so many expressions, that I had to actually analyze the problem and solution more thoroughly than ever before. In fact, the regex testers were probably a handicap that prolonged my regex avoidance.
I would also like to request more pictures in celebration of regex day. I have no specific requests, but we should have something to celebrate, right?
I completely agree - this kind of stuff doesn't really click until you try it out in the field, so to speak. And even then, there's stuff that is just always complex. I've been loving RegEx for years and I still get tripped up and things don't work like I expect them to.
Pictures... I'll see what I can do :)
Great presentation @ NYCFUG, Ben. You really helped fill in some of the missing pieces for me.
And, today, I used what I learned to debug some htaccess rules that were giving me problems!
Thanks my man! HTAccess stuff can be such a pain to debug! URL rewriting stuff in general is a pain because seeing where things are going wrong is never easy with CFDump :D
Thanks for a great presentation, Ben! I enjoyed it and it really took some of the mystique out of RegEx.
My pleasure! It was also good running into you at the NYC UPA last night. Those presentations are so cool.
@Ben, I am somewhat of a UX fresk, but I don't get to use it much currently :(
So, I entertain and educate myself at the meetups, etc.
And it was GREAT to see you an Clark's familiar, lovely faces. :D
Ha ha, thanks :) I'm trying to get much more into UX which is interesting, trying to constantly not worry about code, just about experience. I'm sure I'll see you more meetings then.
Awesome presentation. However I have a request for the HTML presentation. Could you possibly have "Next" and "Prev" buttons for navigation instead of clicking anywhere? One, because when I select some text to copy it, it goes to the next slide. And two, it would be easier to go backward instead of adjusting the url. Thanks!
You can use the left/right arrows to help you navigate between the slides. But, I agree on the copy-paste stuff. I have also felt that problem with my own slides :(
Doh! That makes perfect sense.
Even with the left/right, you are still correct - you can't copy and paste (at least not easily without losing the current slide). It is an experience that could easily be improved.
Hey, just wanted to say thanks for this video tutorial. It really helped me create some regex solutions for front-end data validation.
Keep up the good work.
Thanks for taking the time to make this video and post it for all to see.
I've been around pattern matching for a long time, mostly using OmniMark. I've only used RegEx when working in ColdFusion and then just scratching the surface of it. I was surprised that RegEx has a look ahead function, something I used a lot in OmniMark.
Also, I appreciated your off-topic comments and felt the compassion in your voice regarding making it comfortable for users. In the old days, it seemed like programmers were often lazy and would not go the extra mile to make things easier for users. I hope that has changed.