Video Description

Regular Expressions in Python This lesson covers Regular Expressions (re) in Python. Regular Expressions in Python are accomplished via the 're' module and consist of two types of characters: - Ordinary: (A, a, B, b)

  • Special: ".", "*", '?"

An example of an expression in Python is /d{3}-/d{3}-/d{4}. This is a pattern which can be used to find an American phone number and consists of special characters, specifies how many of a character we are looking for. Participants also learn about Regular Expression (re) methods and Match Objects Methods: - compile: turns the pattern into something the regex engine can understand

  • search: scans a string for the pattern and returns to a MatchObject for the first match

  • match: only checks the beginning of the string for the pattern

  • object.group: returns subgroups of a Match Object

  • strt/reobject.end: return the string indices at which the match starts and ends

  • re: contains the regex pattern matched

This lesson also covers multithreading, which can increase speed, among its other advantages, however a disadvantage is that it's harder to track down errors over multiple threats. Finally, participants also learn about a mutex (mutually exclusive) lock which is a means of controlling access to a resource.

Course Modules