Regexdrill

Level 1: Basics Exercise 12 of 70 Free

Anchors: lines that end with a period

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

A match anywhere counts, so anchor the pattern yourself. Match lines whose last character is a period. A period followed by a space or anything else does not count.

What this exercise teaches

\.$ needs a literal period right before the end of the line. An unescaped dot would accept any last character, and without $ a period anywhere in the line would count.

A hint if you get stuck

$ outside brackets means the end of the line. The period is a special character, so escape it.

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. A free account adds the worked solution; Pro adds timed mode and the certificate.

Open this exercise

More exercises in Basics