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
Exact matches and escape patterns give us flexibility for what we're looking for, but when something occurs multiple times, we have to specify it multiple times. Counts makes Python do that work for us.
New terms
-
\w{3}
- matches any three-word characters in a row. -
\w{,3}
- matches 0, 1, 2, or 3-word characters in a row. -
\w{3,}
- matches 3 or more word characters in a row. There's no upper limit. -
\w{3, 5}
- matches 3, 4, or 5-word characters in a row. -
\w?
- matches 0 or 1-word characters. -
\w*
- matches 0 or more word characters. Since there is no upper limit, this is, effectively, infinite word characters. -
\w+
- matches 1 or more word characters. Like*
, it has no upper limit but must occur at least once. -
.findall(pattern, text, flags)
- Finds all non-overlapping occurrences of thepattern
in thetext
.
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