B.5 Atomic Zero-Width Assertions

The following table describes the atomic zero-width assertions. The metacharacters described in the following table do not cause the engine to advance through the string or consume characters. They simply cause a match to succeed or fail depending on the current position in the string.

Table B.6

List of Atomic Zero-Width Assertions

Assertion

Description

^

Specifies that the match must occur at the beginning of the document or the beginning of the line.

For example, ^#region returns only those occurrences of the character string #region that occur at the beginning of a line.

$

Specifies that the match must occur at the end of the string, before \n at the end of the string, or at the end of the line.

\A

Specifies that the match must occur at the beginning of the document.

\z

Specifies that the match must occur at the end of the document.

\b

Specifies that the match must occur on a boundary between \w (alphanumeric) and \W (nonalphanumeric) characters.

\B

Specifies that the match must not occur on a \b boundary.