If you've ever taught or taken a formal languages course, you know the workflow: the exercise says write a regular expression for all strings over {a,b} containing an even number of a's, you write (b|ab)* on paper... and then you have no way to check it.
Programming regex flavors can't validate it for you — they're full of conveniences the formal dialect doesn't have: character classes, quantifier shorthands, anchors. What you want is a checker that speaks the textbook dialect: union ∪ or |, concatenation, Kleene star *, plus +, parentheses. Nothing more.
RegexTester.dev now ships a Formal Automata Theory flavor exactly for this.
What it accepts
- Symbols from your chosen alphabet (typically
a,b, or0,1) - Union:
∪or| - Concatenation: juxtaposition or
. - Kleene star:
*, and one-or-more:+ - Grouping with parentheses
Everything else — \d, [a-z], lookahead, backreferences — is rejected with an explanation, because the point is to exercise exactly the constructs the course covers.
Instant feedback
Type the expression and test strings in, and you immediately see which strings match and which don't — so you can iterate on the exercise instead of waiting for a grader.
The flavor runs on the same engine infrastructure as the other eight dialects (PCRE2, RE2, .NET, Python, Java, Go, Rust, JavaScript), so the matching behavior is well-defined and consistent.
Why a browser tool for coursework?
Because the feedback loop is everything when learning. The gap between writing (b|ab)* on paper and knowing whether it's right is where most of the confusion in a formal languages course lives. Close that gap to seconds and students experiment their way to understanding: they can see that (b|ab)* matches babb but not abab, and fix their mental model immediately.
It also works the other direction: instructors can build exercise sets with permalinks — every regex and test string combination in the tester has a shareable URL, so "check your answer against this" becomes a link.
Try it: open regextester.dev, pick the Formal Automata flavor from the selector, and test that even-number-of-a's exercise.
Full write-up: regextester.dev/blog/Formal-automata-theory-flavor. Free, no signup — built for students and educators.
Top comments (0)