Regular Expression Calculator

Literals, ., character classes, groups, alternation, * + ? {m,n}, anchors ^ $, and \d \w \s. Negated shorthands such as \D work outside brackets but are rejected inside them. No slashes or flags.
The search stops and reports "gave up" if it would take more work than this. It protects the page, not the answer.
Match found
yes
Regular Expression Tester
First match
555-0199
Match starts at index
5
Match ends before index
13
Gave up (budget exhausted)
no
Simulation steps used
68
Compiled instruction count
9
Worked out from Ken Thompson, "Programming Techniques: Regular expression search algorithm", Communications of the ACM 11(6), 1968 and 1 other source.
This tester is deliberately not JavaScript-compatible on two points: it matches leftmost-longest rather than leftmost-first, and it refuses backreferences and lookaround outright. A pattern that works here may behave differently in a backtracking engine, and one that hangs a backtracking engine will finish here.

How this is worked out

2 steps
  1. Compiled "\d{3}-\d{4}" to 9 NFA instructions.
  2. Leftmost-longest match at [5, 13): "555-0199" in 68 steps.

Results are general information, not financial, tax, legal, medical or engineering advice.