Exam-style question
Try this first
Which pair of strings are both recognised by the regular expression colou?r?.
- A.color and colour
- B.colouur and colour
- C.colo and colour
- D.color and colouur
Answer and explanation
Concise answer
color and colour
Why this is correct
The ? means that the preceding character, u, occurs zero or one time. Therefore, both color and colour are recognised.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
