Multiple choice

Which regular expression would grab a number at the beginning of a line?

  1. $[1..10]
  2. ^[1..10]

  3. $\D
  4. ^\d

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In regular expressions, '^' denotes the beginning of a line, and '\d' represents any digit (0-9). Therefore, '^\d' matches a digit at the start of a line.