Regexdrill

Level 1: Basics Exercise 14 of 88 Free

Word boundaries: the whole word is

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. Match lines that contain is as a whole word. The letters is inside a longer word, as in this or island, do not count.

What this exercise teaches

\bis\b only matches is when no letter, digit or underscore touches it on either side. \b takes up no characters: it is a position, like ^ and $.

A hint if you get stuck

\b matches the position between a word character and a non-word character, or the start or end of the line. Put one on each side of the word.

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