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
Character repetition is one of the more powerful features of regular expressions. Learn how to match repeated characters.
Code Snippet
Here's the serial numbers used in the video for easy copy and pasting:
E4763GHC
7896TOB3P
L0003
Practice
Copy both the Match and the Exclude set of test strings from each exercise below into 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:
8 pieces
7 piece
6 pieces
5 pieces
4 pieces
Exclude:
A piece
A 12345
2 )
Match:
8 pieces
7 piece
6 pieces
5 pieces
4 pieces
2 pie slices
Exclude:
A piece
A 12345
3 )
Match:
1234
5678
84753
78930
Exclude:
abcde
abcde
power
bat!
4 )
Match:
123abc
333cats
821_Plants
769___
Exclude:
454!_Minutes
12statues
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