Question
1. Why does bhw*b match hills? Give two other words it might match. 2. Write a regular expression that captures the counts in sentences like
1. Why does \bh\w*\b match hills? Give two other words it might match.
2. Write a regular expression that captures the counts in sentences like The most popular baby name in 2018 was Claire with 18101 births.
3. Explain (or give code) how to use finditer, Match, and Match.start to find all indices where a given char appears in a string s.
4. Outside of the US, it is common to write dates in the form year.month.day, e.g., 2020.01.05 for January 05, 2020. Write a regular expression that matches a date written in this form.
5. Write a regular expression to capture only correct IPv4 addresses, e.g., it should match 174.17.6.152 but not 825.603.971.243. Capture each of the four numbers separately.
python
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started