Week 5: Regular expressions#
- Turning strings into structured things
- Running example: DNA and amino acid motifs
- DNA and amino encoding
- Translating DNA to amino acids
- Translating DNA to amino acids
- Motifs
- Finding motifs by hand
- Regular expressions: a better way
- Characters and character classes
- Matching practice
- The re module
- re.findall practice
- Special characters, escape characters, and raw strings
- Escaping practice
- Choice a/k/a parallel composition; groups
- Choice practice
- Repetition
- US phone numbers
- Unbounded repetition
- Using re.search, re.match, and re.fullmatch
- Practice with Match objects
- ISO 8601 dates
- Substitutions and backreference
- A word of caution