Regular Expressions in Python Course (How To)
Offered By: Treehouse
Course Description
Overview
Regular expressions are one of the tools that every programmer needs, but is often scared of. In this course, we'll explore the re module that Python provides and learn to write regular expressions for many different situations.
What you'll learn
- Search methods
- Patterns
- Converting messy text into something useful
Syllabus
Introduction to Regular Expressions
Let's break down regular expressions and their methods so we can turn a block of messy text into useful dictionaries. We'll use .match(), .search(), and .findall() to find matches for our patterns, and we'll build our patterns up from something very precise to something more flexible and powerful. Finally, we'll turn our text into real Python dictionaries.
Chevron 19 steps-
Reading Files
7:00
-
Basics
4 questions
-
The Basics
5 objectives
-
Escape Hatches
5:23
-
Escapes
4 questions
-
Escapes
2 objectives
-
Counts
6:05
-
Phone Numbers
1 objective
-
Word Length
1 objective
-
Sets
5:42
-
Email
1 objective
-
Negation
8:20
-
Negated Numbers
1 objective
-
Groups
9:45
-
Name Groups
1 objective
-
Email Groups
2 objectives
-
Compiling and Loops
6:51
-
Players Dictionary and Class
2 objectives
-
Review: Regular Expressions in Python
8 questions
-
Extra Credit
Write a class to represent a person based on the information in the text file. They should have names, email addresses, phone numbers, jobs, and Twitter accounts. Remember, some of these can be blank, though!
To go ever further, make a class to act as as address book to hold all of the people class instances created above. Can you make it searchable?
Related Courses
Artificial Intelligence for RoboticsStanford University via Udacity Intro to Computer Science
University of Virginia via Udacity Design of Computer Programs
Stanford University via Udacity Web Development
Udacity Programming Languages
University of Virginia via Udacity