Regexdrill

Level 1: Basics Exercise 8 of 88 Free

Zero or more: log, log1, log2024

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 the word log followed by zero or more digits, so log, log1 and log2024 all match.

What this exercise teaches

log\d* takes the three letters and then as many digits as there are, including none. The plus sign would demand at least one digit and reject the plain word log.

A hint if you get stuck

The star means zero or more of the thing before it, so the digits may be missing altogether.

Try it now, free, no account needed

Every exercise on Regexdrill is free to try. Open it on the practice page, solve it, and get instant feedback with a hint. The worked solution opens once you solve it or after two tries.

Open this exercise

More exercises in Basics