A ten-question regex quiz you answer by writing real patterns that run against test strings, one 15-minute clock, and a score broken down by skill area. No sign-up to start.
An example of the result you get: a score, your time, and each skill area marked.
What the test covers
Regular expressions come down to a short list of skills, from character classes to lookarounds. The test takes two questions from each of the five levels, picked at random each time.
Basics
Literal text, character classes and ranges, counted repeats, anchors, escaping and the i flag. [a-z] \d + * ? ^ $
These come from the same pool as the test, one of each kind: match, extract and replace. In the test you type the pattern, the lines shown highlight as you type, and your answer is also checked on hidden test strings.
Q1US ZIP and ZIP+4
Real-world validation
The whole line must match. Match a five-digit ZIP code, optionally followed by a hyphen and four more digits.
Test lines9 lines shown, plus 4 hidden test strings in the exercise
Line
Should match
90210
yes
1234
no
02134
yes
123456
no
12345-6789
yes
12345-678
no
00501
yes
12345 6789
no
ABCDE
no
Show the answer
Pattern/\d{5}(?:-\d{4})?/
\d{5}(?:-\d{4})? allows 90210 and 12345-6789 but nothing in between.
Capture the first standalone four-digit number on each line in group 1. Digits that are part of a longer number do not count. Lines without one give no match.
Lines to extract from4 lines shown, plus 3 hidden test strings in the exercise
Line
Expected capture
Released in 1998
"1998"
Copyright 2024 Acme
"2024"
Founded 1887, rebuilt 1920
"1887"
No year here
no match
Show the answer
Pattern/\b(\d{4})\b/
\b(\d{4})\b captures four digits with a boundary on each side, so 12345 is skipped instead of yielding 1234.
Each question is worth one point. You get the point when your pattern passes every line shown and every hidden test string, so a pattern that only fits the visible lines does not score.
You can check a pattern as often as you like while the clock runs. A question you skip, or have not solved when the 15 minutes end, counts as wrong.
The result shows your score out of 10, the time you took, and each skill area as strong or to review, with links to the exercises for the areas you missed.
What your score means
0
1
2
3
4
5
6
7
8
9
10
0 to 4Build the basics first
Start with the first levels and work up. Short daily practice moves this score quickly.
5 to 7Working knowledge
The core is there. The areas you missed are the ones to drill next.
8 to 10Fluent on this set
You solved questions from nearly every level under the clock. Drill the one or two areas you missed and you are in good shape.
These bands describe this test only. They are not a pass mark for any employer or course.
Take the test
10 questions from 5 skill areas, 15 minutes on the clock. It starts right here, with no account and no email.
Hints and answers are off while the clock runs.
Check a pattern as often as you like. Skip counts as wrong.
Your answers survive a page reload.
The mistakes that cost the most points
Six slips worth fixing before a timed regex test.
An unescaped dot. A dot matches any character, so 4.99 also matches 4x99. Write \. for a literal dot.
Greedy where lazy is needed. ".*" runs from the first quote to the last one on the line. ".*?" stops at the next quote.
Alternation that reaches too far. ^yes|no$ means starts with yes, or ends with no. Group the alternatives: ^(?:yes|no)$.
A match inside a longer value. \d{4} finds 1234 inside 12345. A word boundary on each side, \b\d{4}\b, keeps to standalone numbers.
A missing g flag in a replacement. Without g only the first match on the line is replaced.
Nested repeats. A pattern like (a+)+ can take a very long time on a near miss. The checker here rejects a pattern that runs too long.
The three kinds of question in the test
Match: write a pattern that matches the lines it should and none of the others. Some questions need the whole line to match, others count a match anywhere on the line.
Extract: capture the right part of each line in a group, such as the year in a sentence or the level in a log line.
Replace: write the pattern and the replacement text, such as turning MM/DD/YYYY into YYYY-MM-DD.
Questions
Is the regex practice test really free?
Yes. The test and every exercise on Regexdrill are free. There is no card, no daily limit and nothing to unlock.
Do I need an account or any software?
No to both. The test starts in one click and runs in your browser. The lines shown highlight as you type, and your answer is checked on the server against hidden test strings.
How long does the test take?
Up to 15 minutes. There are 10 questions on one clock, and the test ends when you finish the last question or the time runs out.
How is the test scored?
One point per question, 10 in total. A pattern scores when it passes every line shown and every hidden test string. Skipped or unsolved questions count as wrong. You also get a breakdown by skill area.
Is this a multiple-choice regex quiz?
No. Every question is hands-on: you type a pattern, and for replace questions the replacement text, and it is run against real test strings. That is closer to how regular expressions are used at work than picking an answer from a list.
Which regex flavor does the test use?
The JavaScript flavor, with the flags g, i, m, s and u. Character classes, groups, backreferences, lookahead, lookbehind and named groups work as they do in current browsers. Most of what you practice carries over to Python, Java and PCRE with small differences.
Can I retake the test?
Yes, as often as you like. The questions are drawn at random from the exercise pool, so a retake is a different test.
What comes after the test?
Your result links straight to the exercises for the areas you missed. All 88 exercises are free, each with hidden test strings and a reference answer. Certificates come with the Dravari bundle.
Find out where you stand
Ten questions, 15 minutes, a score by skill area. Free, and no sign-up to start.