A start of word position matches the position before an alpha-numeric sequence. An end of word position matches the position after an alpha-numeric sequence.

The term word boundary is used to refer to both kinds of positions.

In Perl-compatible programs, \b indicates a start/end of word position.

Matching behaviorEdit

They don't match any character, but the position between two characters, or between a character and nothingness.


\bvar\b can be used to find Javascript variable declarations. It will match something like "var a = 3", "function set_var", but will not match "function setvar".

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.