15.5. Exercises
Regular Expressions. Create regular expressions in Exercises 15-1 to 15-12 to:
15-1. Recognize the following strings: “bat,” “bit,” “but,” “hat,” “hit,” or “hut.”
15-2. Match any pair of words separated by a single space, i.e., first and last names.
15-3. Match any word and single letter separated by a comma and single space, as in last name, first initial.
15-4. Match the set of all valid Python identifiers.
15-5. Match a street address according to your local format (keep your RE general enough to match any number of street words, including the type designation). For example, American street addresses use the format: 1180 Bordeaux Drive. Make your RE general enough to support multi-word street names like: 3120 De la Cruz Boulevard. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access