>_ IzzyLab

Topic breakdown

Extracting strings of a fixed format is a job for grep -oE, where the format is broken into a sequence of parts and each is described separately. Two subtle regex points come up here: the + character is itself a quantifier ("one or more"), so as a literal plus it requires escaping; and "exactly N digits in a row" is expressed with a digit class and a counting quantifier in curly braces {N}. Hyphen separators outside a character class are not special characters and are written as-is.

What's checked

  1. Number extracted
  2. All numbers found

What it looks like