Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Cleaning Data in PostgreSQL Databases

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

SELECT
  summons_number,
  plate_id,
  registration_state
FROM
  parking_violation
WHERE
  -- Define the pattern to use for matching
  ___ ___ ___ ___ ___;
Code bewerken en uitvoeren