Regexp - Assertion (Condition)

Regexp

About

An assertion is an assertion that specifies a condition that has to be met at a particular point in a match, without consuming any characters from the subject string.

Type

Simple

simple assertion designed by the backslash character.

assertions Description
\b word boundary
\B not a word boundary
\A start of subject (independent of multiline mode)
\Z end of subject or newline at end (independent of multiline mode)
\z end of subject (independent of multiline mode)
\G first matching position in subject

These assertions may not appear in character classes (but note that “\b” has a different meaning, namely the backspace character, inside a character class).

Look-around

Regexp - Look-around group (Assertion) - ( Lookahead | Lookbehind )





Discover More
Regexp
Regexp - Backslash

Backslash is the general escape meta-character with several uses. It can: Stand for itself, Quote the next character, Introduce an operator, Do nothing see The third use of backslash...
Regexp
Regexp - Look-around group (Assertion) - ( Lookahead | Lookbehind )

Look-around are non-capturing group that implements an assertion. question mark Assertion (?=X) X, positive lookahead (via zero-width) (?!X) X, negative lookahead (via zero-width) (?<=X) X,...



Share this page:
Follow us:
Task Runner