LAB 17 OF 31

Regex: match the input

Pick the pattern that accepts the right inputs and refuses the wrong ones.

The diagram

Daily List task codes look like DL-21, DL-305 or DL-7: the letters DL, a dash, then one to four digits. Tom checks patterns against inputs.

  1. Which pattern matches a whole task code and nothing else?
  2. Which input does ^DL-\d{1,4}$ refuse?
  3. A pattern DL-\d+ has no anchors. Which input wrongly passes?
  4. Which is a good extra test input for the correct pattern?

0 of 4 steps chosen.

SYNTHETIC / TRAINING ONLY. The Daily List app and the people in it are made up, and every number is a teaching figure.

What this shows

A regular expression describes the shape of text. A tester reads one to see what it accepts and what it lets through.

Read the lessons

NEXT LAB: GIT: BRANCH, COMMIT AND MERGE →