Regexdrill

Level 1: Basics Exercise 6 of 52 Pro

Counted repeats: 3 to 5 digits

A regex exercise from Regexdrill. Solve it with a pattern box with live highlighting in your browser, checked against hidden test strings, and it is checked the moment you submit.

The task

The whole line must match. Match lines made of 3, 4 or 5 digits and nothing else.

What this exercise teaches

\d{3,5} matches between three and five digits. With the whole line required, six digits or a letter fail.

A hint if you get stuck

Curly braces set a count: {3} is exactly three, {3,5} is three to five.

This exercise is part of Pro

Pro unlocks all 52 exercises, with worked solutions and progress saved to your account. The free exercises work without an account.

You create a free account first, so Pro is attached to it.

Monthly is charged today and then every month until you cancel, in one click from your account page. Lifetime is one payment with no renewals. Full refund within 14 days of paying.

Start with the free exercises

More exercises in Basics