Multiple choice technology programming languages

/d[^oO]g/ matches?

  1. dog

  2. dOg

  3. doOg

  4. dig

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

The pattern /d[^oO]g/ means: d followed by any character EXCEPT o or O, followed by g. dog fails (has o), dOg fails (has O), doOg fails (first match do has o). dig matches because d is followed by i (not o/O), then g.