Table of Contents

Regular Expression - Boundary Matcher

About

The boundary matcher meta

List

Symbol Description
^ The beginning of a line
$ The end of a line
\b A word boundary
\B A non-word boundary
\A The beginning of the input
\G The end of the previous match
\Z The end of the input but for the final terminator, if any
\z The end of the input
< Matches the start of a word
> Matches the end of a word

Example

Word boundary

word boundary

Case 1:

Case 2:

Non-word boundary

A non-word boundary is \B.

Example 1:

Example 2:

End of the previous match

To require the match to occur only at the end of the previous match, use \G:

Example 1:

Example 2:

The second example finds only one match, because the second occurrence of dog does not start at the end of the previous match.

Documentation / Reference