CommencerCommencer gratuitement

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.

Cet exercice fait partie du cours

Cleaning Data in PostgreSQL Databases

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

SELECT
  summons_number,
  plate_id,
  registration_state
FROM
  parking_violation
WHERE
  -- Define the pattern to use for matching
  ___ ___ ___ ___ ___;
Modifier et exécuter le code