QUANTIFIERS

Zero or more, optional

* allows any count including zero. ? makes the previous element optional.

a+ one or more a. Matches "a", "aaa", but not "".
a* zero or more a. Matches "aaa" and also the empty string (zero a).
a? zero or one a - the a is optional. colou?r matches both color and colour.

colou?r matches color and colour: the u may appear once or not at all. `*` is `+` minus the obligation: x* happily matches the empty string, which makes it dangerous alone but powerful after something concrete.

EXERCISE

Match both color and colour.

/ /
color scheme
must match: "color"
colour scheme
must match: "colour"
colouur is wrong
must match nothing