Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Introduction to Regular Expressions!
You have completed Introduction to Regular Expressions!
Preview
Learn how to write simple regular expressions with optional characters.
Practice
Copy each set of test strings into regex101. Using what you've learned so far, create a regular expression that will match all of the strings in the set.
1 )
ladybug
ladybugs
lady bugs
2 )
ladybug
lady bugs
lazy bug
lazy lug
3 )
ladybug
lazy lug
lazy slug
hazy slug
4 )
ladybug
fading rug!
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
However, a regular expression
doesn't work that way.
0:00
Instead, it uses a parser, which compares
each character in a regular expression
0:00
with the character in the string
in the same position.
0:05
In other words,
the RegeEx parser requires two things,
0:09
an expression, also called a pattern,
and a string to match.
0:13
The parser takes that pattern and
0:18
walks through the string,
character by character.
0:20
First it checks if there is a t, then
if the t is followed by an o and so on.
0:24
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up