Homework 2: Added regex error handling