Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
It's important to be able to specify that a regular expression starts matching at the beginning of a string and match all the way to the end. Learn more in this video.
RegexPal
Since the recording of this video RegexPal updated their UI. You can adjust the flags just above the input where you enter your regex. To follow along with this video you'll want to make sure that both the global
and multiline
flags are selected.
Practice
Copy both the Match and the Exclude set of test strings from each exercise below into a Regex tester like RegEx Pal or regex101. Using what you've learned so far, create a regular expression that will match all of the strings in the Match set and exclude the ones in the Exclude set.
1 )
Match:
tart
Exclude:
start
tartan
2 )
Match:
img_01.jpg
img_02.png
img_03.gif
img_04.png
img_05.gif
img_06.jpg
Exclude:
6_img_07.gif
mov_01.avi
3 )
Match:
projector
protractor
projected
Exclude:
proctor
my projector
projecting
projectorlight
4 )
Match:
3456
34567
Exclude:
23456
345678
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
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