Exercise

Detecting invalid values with regular expressions

In the video exercise, we saw that there are a number of ways to detect invalid values in our data. In this exercise, we will use regular expressions to identify records with invalid values in the parking_violation table.

A couple of regular expression patterns that will be useful in this exercise are c{n} and c+. c{n} matches strings which contain the character c repeated n times. For example, x{4} would match the pattern xxxx. c+ matches strings which contain the character c repeated one or more times. This pattern would match strings including xxxx as well as x and xx.

Instructions 1/3

undefined XP
  • 1
    • Write a query returning records with a registration_state that does not match two consecutive uppercase letters.
  • 2
    • Write a query that returns records containing a plate_type that does not match three consecutive uppercase letters.
  • 3
    • Write a query returning records with a vehicle_make not including an uppercase letter, a forward slash (/), or a space (\s).