From the course: Learning Regular Expressions
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Solution: Character sets - Regular Expressions Tutorial
From the course: Learning Regular Expressions
Solution: Character sets
(upbeat music) - Hopefully you did well with this challenge assignment. If you got stuck, don't worry. I'm going to walk you through and show you the answers that I came up with. So once we've got our self-reliance text in our text editor where we can work with it, let's start working on that first task, a regular expression that matches both lives and lived. I think a good way to start is always to write out as much of it as you know, like lives, and then modify it from there to do what we need it to do. So this will match lives. If we also want it to match lived then we need to use a character set. So we can put character set brackets around the S. So it's either the S or the D. Either one is an acceptable character. It's going to match a character that is either S or D. And if we scroll down here, you'll see there's seven matches and they're going to occur a little bit further down in the text. Scroll down, past the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.