Library

ε-NFA · Regular

A phone number, area code optional

ddd-dddd, optionally preceded by an area code in parentheses: d stands for any digit. The ε-move is the word “optionally” — it lets the machine skip the area-code branch without reading anything.

(ddd)εddd-dddd
The machine as drawn — 14 states, 14 transitions.

The author’s examples, run

ddd-dddd → accept(ddd)ddd-dddd → acceptddddddd → reject(dd)ddd-dddd → rejectddd-ddd → reject(ddd)-ddd-dddd → reject